xsl-list
[Top] [All Lists]

RE: [xsl] <xsl:attribute issue

2007-05-16 05:32:33
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(_at_)yahoo(_dot_)com] 
Sent: 16 May 2007 12:03
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] <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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>