There are cases where you'll have a csv and need to do a for-each on each of the tokens.
For ex, a CSV stored in a DVM has to be iterated and needs to be assigned to a target for each of the token
Here is how you can tokenize
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<!-- Here I'm hardcoding the value, but this could be from any xml where you'll give an expression instead of a value, or from a DVM -->
<xsl:variable name='csv' select="'a,b,c'"/>
<items>
<xsl:for-each select="tokenize($csv,',')">
<item>
<xsl:value-of select="."/>
</item>
</xsl:for-each>
</items>
</xsl:template>
</xsl:stylesheet>
And the result is
<?xml version="1.0" encoding="UTF-8"?>
<items>
<item>a</item>
<item>b</item>
<item>c</item>
</items>
For ex, a CSV stored in a DVM has to be iterated and needs to be assigned to a target for each of the token
Here is how you can tokenize
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<!-- Here I'm hardcoding the value, but this could be from any xml where you'll give an expression instead of a value, or from a DVM -->
<xsl:variable name='csv' select="'a,b,c'"/>
<items>
<xsl:for-each select="tokenize($csv,',')">
<item>
<xsl:value-of select="."/>
</item>
</xsl:for-each>
</items>
</xsl:template>
</xsl:stylesheet>
And the result is
<?xml version="1.0" encoding="UTF-8"?>
<items>
<item>a</item>
<item>b</item>
<item>c</item>
</items>
No comments:
Post a Comment