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

Re: List in a variable

Subject: Re: List in a variable
From: Goetz Bock <bock@xxxxxxxxxxx>
Date: Wed, 8 Aug 2001 10:16:40 +0200
Re:  List in a variable
On Wed, Aug 08 '01 at 13:22, Nitin Dutt Mathur wrote:
> <component name="TestCom">
> <class name="Person" type="first">
> ...
> </class>
> <class name="Address" type="second">
> ...
> </class>
> <class name="Info" type="second">
> ...
> </class>
> ...
> </component>
> 
> In the above xml type attribute of class tag can have value either first or
> second. I want to have variable containing names of all the second classes.
> For the above case I want to have a variable (say myVar) with the value
> "Address#Info" where # is just a separating character between the names of
> the class.

<xsl:variable name="myVar">
  <xsl:for-each select="//*[@type='second']">
    <xsl:value-of select="@name"/>
    <xsl:if test="position() != last()">
      <xsl:text>#</xsl:text>
    </xsl:if>
  </xsl:for-each>
</xsl:variable>  

Tested, works.

-- 
Goetz Bock                                              IT Consultant
Dipl.-Inf. Univ.

Attachment: pgp00003.pgp
Description: PGP signature

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.