Witn the bellow XML and XSLT fiel i want to get this:
<table>
<tr><td>res: 102 - res: 22</td><td>res: 56 - res: 31 - res: 36</td></tr>
<!-- more elements here -->
</table>
i want to get one table with 2 columns and x rows. but i dont get it
o dont presents the two columns
can you help me please? i am two weeks with this problem and i dont solve
it.
plase can you help me?
thanks
XML file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<registros>
<votacion>
<registro>
<resultado>102</resultado>
</registro>
<registro>
<resultado>22</resultado>
</registro>
</votacion>
<votacion>
<registro>
<resultado>56</resultado>
</registro>
<registro>
<resultado>31</resultado>
</registro>
<registro>
<resultado>36</resultado>
</registro>
</votacion>
</registros>
XSLT template:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xhtml" version="1.0" encoding="ISO-8859-1"
indent="yes"/>
<xsl:template match="/">
<table>
<xsl:for-each select="/registros/votacion">
<xsl:if test="position() mod 2 = 1 or position()=1">
<xsl:call-template name="Make2ColumnRow">
<xsl:with-param name="FirstItemPositionNo">
<xsl:value-of select="position()"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</table>
</xsl:template>
<xsl:template name="Make2ColumnRow">
<xsl:param name="FirstItemPositionNo"/>
<tr>
<td>
<xsl:for-each select="/registros/votacion/registro">
res: <xsl:variable name="myVarGrafica"
select="self::node()[position()=$FirstItemPositionNo]/resultado" />res:
</xsl:for-each>
</td>
<td>
<xsl:for-each select="/registros/votacion/registro">
res: <xsl:variable name="myVarGrafica"
select="self::node()[position()=$FirstItemPositionNo+1]/resultado" />
</xsl:for-each>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list