Subject: RE: <xsl:attribute issue
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 16 May 2007 13:31:42 +0100
|
In XSLT the input file is read-only, and you execute instructions that
construct a result tree. xsl:attribute adds an attribute to the result tree,
it does not modify the source tree.
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: Vaduvoiu Tiberiu [mailto:vaduvoiutibi@xxxxxxxxx]
> Sent: 16 May 2007 12:03
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: <xsl:attribute issue
>
> Hi, I am trying to create an attribute for one of my xml
> files that has a typoical format like:
> <root>
> <level1>
> <name>Name1</name>
> other tags
> </level1>
> <level1>
> <name>Name2</name>
> other tags
> </level1>
> </root>
>
> so I'm trying to set the attribute of the name element before
> displaying it:
>
> <xsl:for-each select=level1>
> <xsl:variable ....{here I get a variable so that's why I
> can't call directly for each level1/name>
>
> <xsl:for-each select="name">
> <xsl:attribute name="test">
> <xsl:value-of select="4"/>(just for testing,
> instead of 4 I have a variable but I put 4 for testing)
> </xsl:attribute> <xsl:for-each> </xsl:for-each>
>
>
> and then if I try to display it using
> <xsl:for-each select="level1/name">
> <xsl:value-of select="@test"/>
> </xsl:for-each>,
>
> it doesn't display anything.
>
> So where exactly am I going wrong? 10x in advance
>
>
>
> ______________________________________________________________
> ______________________Get the Yahoo! toolbar and be alerted
> to new email wherever you're surfing.
> http://new.toolbar.yahoo.com/toolbar/features/mail/index.php
|