Subject: Re: [xsl] comparing values From: "Joris Gillis" <roac@xxxxxxxxxx> Date: Sun, 20 Feb 2005 21:21:26 +0100 |
Hi,hello i have into one xml this: - <eleccion> <eleccionusuario_id>219</eleccionusuario_id> <eleccion_id>2</eleccion_id> <usuario_id>55</usuario_id> <eleccionusuario_valor>false,true,false,false,true,false,true,false,false</eleccionusuario_valor> </eleccion>
into the <eleccionusuario_valor> node there is this: false,true,false,false,true,false,true,false,false how can i change this values with number using xsl? it the node value is: false,true,false,false,true,false,true,false,false the result must be 2,5,7 the tru values are numbres.
<xsl:template match="eleccionusuario_valor"> <xsl:call-template name="number"/> </xsl:template>
<xsl:template name="number"> <xsl:param name="index" select="1"/> <xsl:param name="string" select="."/> <xsl:if test="substring-before($string,',') = 'true'"> <xsl:value-of select="$index"/> <xsl:if test="contains(substring-after($string,','), 'true')"> <xsl:text>,</xsl:text> </xsl:if> </xsl:if> <xsl:if test="contains($string,',')"> <xsl:call-template name="number"> <xsl:with-param name="string" select="substring-after($string,',')"/> <xsl:with-param name="index" select="$index + 1"/> </xsl:call-template> </xsl:if> </xsl:template>
regards, -- Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041) "Et ipsa scientia potestas est" - Francis Bacon , Meditationes sacrae
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] comparing values, Dionisio Ruiz de Zár | Thread | [xsl] creating criterions to group, Marcos Hercules dos |
Re: [xsl] XSL editor, Jacob Briggs | Date | [xsl] Following-sibling node test, Maria Amuchastegui |
Month |