Tempore 17:26:49, die 02/20/2005 AD, hinc in
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com scripsit Dionisio Ruiz de Zárate
<dionisio(_at_)tinieblas(_dot_)com>:
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.
Hi,
In XSLT1.0, you'd have to use some recursively called template that does
some string-realted tests.
e.g.:
<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>
(tested with AltovaXSLT)
regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
"Et ipsa scientia potestas est" - Francis Bacon , Meditationes sacrae
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--