Hi,
Hmmm, I can't quite figure out how to do this with xslt. I'm extremely new to this technology, however, so I'm sure(hope?) there's an easy solution...
Let's say a portion of my to-be-transformed xml file looks as so:
and I need to format this as text as follows:
HOW can I code something to append a comma after the first (n-1) elements, but not the nth??? Otherwise, the resultant (output)code won't parse properly.
I've tried something like this:
but of course this appends a comma after EVERY element, including the nth... How can I "know" when I'm at the last node of the "data"-node set, so as to avoid appending a comma? I could also prepend commas, but in that case I'd need to be able to know when I'm processing the first "data" node, so as to avoid prepending a comma to it... That might be easier, maybe? To isolate the first-node-processed case? Or is something like this patently impossible (I sure hope not!!)
Any help *greatly* appreciated.. I need to figure this out in order to generate the code I need at work!!!
Thanks!!
dora
Hmmm, I can't quite figure out how to do this with xslt. I'm extremely new to this technology, however, so I'm sure(hope?) there's an easy solution...
Let's say a portion of my to-be-transformed xml file looks as so:
Code:
<data>d1</data>
<data>d2</data>
.
.
.
<data>dn</data>
Code:
d1,
d2,
.
.
.
dn
I've tried something like this:
Code:
<xsl:template match="some context...">
<xsl:apply-templates select="data">
</xsl:template>
<xsl:template match="data">
<xsl:value-of select="."/><xsl:text>,</xsl:text>
</xsl:template>
Any help *greatly* appreciated.. I need to figure this out in order to generate the code I need at work!!!
Thanks!!
dora