XSL Append & XSL Variable !!!
498906Apr 18 2006 — edited Feb 6 2008Hi,
If anyone has any ideas on the below problem I would sincerely appreciate it as it is driving me crazy!!!
I need to concatenate/append the contents of a Collection node into a string variable, such that each element is comma seperated in the string. I need to do this to pass the string of comma seperated values into a 3rd party service that I am calling. It looks like I would use an XSL transform to achieve this. However, it appears to be impossible because Oracle Transform mapper does not support <xsl:variable> ie. I get "unsupported" when I try to use this.
So,for example, I want to convert the following collection
<NamesCollection>
<name>A</name>
<name>B</name>
<name>C</name>
<name>D</name>
<name>E</name>
<name>F</name>
<name>G</name>
<name>H</name>
</NamesCollection>
...such that it would become:
<NAMES>A,B,C,D,E,F,G,H</NAMES>
I found some sample XSL code in google:
<xsl:variable name="String">
<xsl:for-each select="/NamesCollection">
<xsl:value-of select="name" />
<xsl:text>,</xsl:text>
</xsl:for-each>
</xsl:variable>
However, Oracle mapper does not support "xsl:variable". So the above is no good.
I cannot also nest a "for-each" inside a node,
Eg.
<NAMES>
<xsl:for-each select="/NamesCollection">
<xsl:value-of select="name"/>
</xsl:for-each>
</NAMES>
because it complains:
Error: Invalid Usage of <for-each> Element
If anyone has any suggestions, they would be sincerely appreciated !!!!!!!!!