Re: [XSLT/newbie]value-of attributes of the root node

Subject: Re: [XSLT/newbie]value-of attributes of the root node
From: "John E. Simpson" <simpson@xxxxxxxxxxx>
Date: Tue, 19 Sep 2000 12:02:01 -0400
At 02:25 PM 09/19/2000 +0000, nik.makepeace@xxxxxxxxxxxx wrote:
The source is:
<description name="AirCon 5000">
 <change recency="7">
 text
 </change>
 <change recency="4">
 text
 </change>
 <change recency="3">
 text
 </change>
</description>

but this template returns nothing between <name> and </name>:

<xsl:template match="/">
 <outputroot>
  <name><xsl:value-of select="@name" />
  </name>
 <xsl:apply-templates />
 </outputroot>
</xsl:template>

The template matches on the document root node, not on the document root *element* node. So the xsl:value of selects on the attribute of the root node, which of course has no attributes.


Try changing the match pattern to match="/description".

==========================================================
John E. Simpson | "If you were going to
http://www.flixml.org | shoot a mime, would you use
XML Q&A: http://www.xml.com | a silencer?" (Steven Wright)



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread