Subject: Re: [xsl] Value of the variable From: Florent Georges <lists@xxxxxxxxxxxx> Date: Thu, 26 Nov 2009 01:58:37 -0800 (PST) |
Joga Singh Rawat wrote: > If I have "a, b, <i>c</i>, > <b>d</i>" I want to get [...] > ==>OK!!! The output should be > <a-g><a>a</a><a>b</a><a><i>c</i></a><a><b>d</b></a></a-g> So your input structure is driven by both the input's structure and the input's string value format. The answer thus depends on how both relate to each other. What if you have something like: a, b, <i>c, d</i> or: a, b, <i>c</i>d ? For your initial sample and the first sample here above, you should be able to use something like this (not tested!): <xsl:template match="node()" mode="my:tokenize" priority="10"> <xsl:variable name="nodes" as="item()+"> <xsl:next-match/> </xsl:variable> <xsl:for-each select="$nodes"> <a> <xsl:sequence select="."/> </a> </xsl:for-each> </xsl:template> <xsl:template match="text()" mode="my:tokenize"> <xsl:value-of select="tokenize(., '\s*,\s*')"/> </xsl:template> <xsl:template match="i|b" mode="my:tokenize"> <xsl:for-each select="tokenize(., '\s*,\s*')"> <xsl:copy> <xsl:value-of select="."/> </xsl:copy> </xsl:for-each> </xsl:template> -- Florent Georges http://www.fgeorges.org/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Value of the variable, Joga Singh Rawat | Thread | Re: [xsl] Value of the variable, Hermann Stamm-Wilbra |
RE: [xsl] Value of the variable, Joga Singh Rawat | Date | RE: [xsl] Value of the variable, G. Ken Holman |
Month |