xsl-list
[Top] [All Lists]

Re: Coma delimited values in attribute

2005-09-16 14:27:57
<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:

+--------+-----+---+-----+
| tarif1 | str | 1 | 152 |
+--------+-----+---+-----+
| tarif2 | cur | 1 | 100 |
+--------+-----+---+-----+
| tarif3 | str | 1 | 252 |
+--------+-----+---+-----+
| tarif4 | cur | 1 | 203 |
+--------+-----+---+-----+

--
Best regards, Belousov Alexey


--~------------------------------------------------------------------
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>
--~--




--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>