This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


At 02:25 PM 09/19/2000 +0000, nik.makepeace@webtribe.net 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]