Subject: [xsl] position() within for-each usage From: "Nuri Besen" <nb_news@xxxxxxxxxxx> Date: Thu, 06 Jun 2002 13:04:15 -0400 |
<data> <item> <name>xyz</name> <lineitem> <cost>24</cost> <lineitem> <cost>30</cost> <item> <name>abc</name> <lineitem> <cost>24</cost> <lineitem> <cost>30</cost>
<xsl:template match="item"> <xsl:for-each select="lineitem"> For item #<xsl:value-of select="position()"> <xsl:value-of select="../name"> the cost for lineitem is <xsl:value-of select="cost"> </xsl:for-each> </xsl:template>
Sample output should be: For item #1 xyz the cost for lineitem is 24 For item #1 xyz the cost for lineitem is 30 For item #2 abc the cost for lineitem is 24 For item #2 abc the cost for lineitem is 30
BUT it gives: For item #1 xyz the cost for lineitem is 24 For item #2 xyz the cost for lineitem is 30 For item #1 abc the cost for lineitem is 24 For item #2 abc the cost for lineitem is 24
Thanks, Nuri
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] newbie: multiple output f, Michael Kay | Thread | Re: [xsl] position() within for-eac, Mike Brown |
Re: [xsl] xslt readability/maintain, Mike Brown | Date | Re: [xsl] xsltproc (was Re: XSL-Lis, Kevin Jones |
Month |