This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: <xsl:for-each> help
- From: "Thomas B. Passin" <tpassin at mitretek dot org>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Wed, 1 May 2002 17:56:06 -0400
- Subject: Re: [xsl] <xsl:for-each> help
- References: <200205012117.g41LHW713992@allfools.net>
- Reply-to: xsl-list at lists dot mulberrytech dot com
[Zoe Peng]
> many thanks.
> I won't be able to use <xsl:if test...> cuz the xml document is
> generate on the fly and the key is coming from parameter. But, I got
> what I need. It outputs "My News".
>
> This is what I want:
> <xsl:for-each select='dynamictree/category[@id="1"]'>
> <xsl:for-each select='service[@id="01"]'>
> servicename: <xsl:value-of select="@name" />
> </xsl:for-each>
> </xsl:for-each>
Glad I could help. I don't think you need the double for-each, though,
depending on what else you do in them that you haven't explained. Just by
what you have shown, a single for-each would do what you need. You could use
<xsl:for-each
select='dynamictree/category[@id="1"]/service[@id="01"]'>
Depending on whether there would be more than one of them, you might not
even need to use any for-each at all, just the value-of.
Cheers,
Tom P
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list