<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vis="vishFunction"
exclude-result-prefixes="xs vis"
version="2.0" >
<xsl:variable name="assets" select="'123 234 456 789 0001'"/>
<xsl:output method="html"></xsl:output>
<xsl:template match="/">
<xsl:sequence select="vis:nestedList($assets)"/>
</xsl:template>
<xsl:function name="vis:nestedList">
<xsl:param name="assetID"/>
<ul>
<li>
<xsl:variable name="firstToken" select="tokenize(normalize-space($assetID),' ')[1]"/>
<xsl:value-of select="$firstToken"/>
<xsl:variable name="restAssets" select="normalize-space(substring-after($assetID,$firstToken))"/>
<xsl:if test="string-length(normalize-space($restAssets)) != 0">
<xsl:message><xsl:value-of select="$restAssets"/></xsl:message>
<xsl:sequence select="vis:nestedList($restAssets)"/>
</xsl:if>
</li>
</ul>
</xsl:function>
</xsl:stylesheet>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vis="vishFunction"
exclude-result-prefixes="xs vis"
version="2.0" >
<xsl:variable name="assets" select="'123 234 456 789 0001'"/>
<xsl:output method="html"></xsl:output>
<xsl:template match="/">
<xsl:sequence select="vis:nestedList($assets)"/>
</xsl:template>
<xsl:function name="vis:nestedList">
<xsl:param name="assetID"/>
<ul>
<li>
<xsl:variable name="firstToken" select="tokenize(normalize-space($assetID),' ')[1]"/>
<xsl:value-of select="$firstToken"/>
<xsl:variable name="restAssets" select="normalize-space(substring-after($assetID,$firstToken))"/>
<xsl:if test="string-length(normalize-space($restAssets)) != 0">
<xsl:message><xsl:value-of select="$restAssets"/></xsl:message>
<xsl:sequence select="vis:nestedList($restAssets)"/>
</xsl:if>
</li>
</ul>
</xsl:function>
</xsl:stylesheet>
No comments:
Post a Comment