Jump to content

Match all nodes except for the first


yoshimura

Recommended Posts

I'd like to match everything for the first child node of the root.Here's how my XSLT starts out:

<xsl:template match="/">		<html>			<head>				<link rel="stylesheet" type="text/css" href="lexpress.css" />				<title>L'Express — <xsl:value-of select="/Lexpress/Date"/></title>			</head>			<body>				<h1>L'Express</h1><p class="date"><xsl:value-of select="/Lexpress/Date"/></p>				<xsl:apply-templates/>			</body>		</html>	</xsl:template>

The DOM tree looks like this:Root Date Article Article Article ArticleI don't want the Date element to show up at the top of the HTML output document.

Link to comment
Share on other sites

Either make sure your apply-templates processes only the elements you are interested in so perhaps doing

<xsl:apply-templates select="Root/Article"/>

instead of the

<xsl:apply-templates/>

you have helps.Or add

<xsl:template match="Date"/>

that way the Date element will be processed but not generate any output.

Link to comment
Share on other sites

This:

<xsl:apply-templates select="Root/Article"/>

Does indeed work.I was being too generic with my DOM tree example; Each Article element actually have different names. There is a possibility of 30-something different element names that are children of the root.The code below didn't work:

<xsl:template match="Date"/>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...