[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: <xsl:attribute issue

Subject: RE: <xsl:attribute issue
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 16 May 2007 13:31:42 +0100
RE:  <xsl:attribute issue
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.