Re: [xsl] Coma delimited values in attribute

Subject: Re: [xsl] Coma delimited values in attribute
From: Andrew Franz <afranz0@xxxxxxxxxxxxxxxx>
Date: Sat, 17 Sep 2005 07:27:57 +1000
<xsl:template match="Fields">
   <table border="1">
   <xsl:call-template name="row">
       <xsl:with-param name="f1" select="field[1]/@value" />
       <xsl:with-param name="f2" select="field[2]/@value" />
       <xsl:with-param name="f3" select="field[3]/@value" />
       <xsl:with-param name="f4" select="field[4]/@value" />
   </xsl:call-template>
   </table>
</xsl:template>

<xsl:template name="row">
<xsl:param name="f1" />
<xsl:param name="f2" />
<xsl:param name="f3" />
<xsl:param name="f4" />

<xsl:if test="not(concat($f1,$f2,$f3,$f4)='')" >
<tr>
<td><xsl:value-of select="substring-before(concat($f1,','),',')" /></td>
<td><xsl:value-of select="substring-before(concat($f2,','),',')" /></td>
<td><xsl:value-of select="substring-before(concat($f3,','),',')" /></td>
<td><xsl:value-of select="substring-before(concat($f4,','),',')" /></td>
</tr>
<xsl:call-template name="row">
<xsl:with-param name="f1" select="substring-after($f1,',')" />
<xsl:with-param name="f2" select="substring-after($f2,',')" />
<xsl:with-param name="f3" select="substring-after($f3,',')" />
<xsl:with-param name="f4" select="substring-after($f4,',')" />
</xsl:call-template>
</xsl:if>
</xsl:template>



Belousov Alexey wrote:


Hello all.
I'm a bit new to XSL and currently having a problem. Any help would be
greately apreciated.

I have the following XML:

-------[XML]------------------------------------------------------------
<Fields>
<field name="tarifSelect" value="tarif1,tarif2,tarif3,tarif4" />
<field name="numberType"  value="str,cur,str,cur" />
<field name="cardsNum"    value="1,1,1,1" />
<field name="price"       value="152,100,252,203" />
</Fields>
------------------------------------------------------------------------

I want it to be representd as a HTML table like:

Current Thread