This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: List in a variable
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] List in a variable
- From: "Nitin Dutt Mathur" <nitin at pscindia dot com>
- Date: Wed, 8 Aug 2001 17:44:09 +0530
- Reply-To: xsl-list at lists dot mulberrytech dot com
Thanks it does work.
> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Goetz Bock
> Sent: Wednesday, August 08, 2001 1:47 PM
> To: xsl-list@lists.mulberrytech.com
> Subject: Re: [xsl] 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.
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list