Subject: [xsl] two cols in one table (a little long) From: "Dionisio Ruiz de Zarate" <dionisio@xxxxxxxxxxxxx> Date: Wed, 5 Mar 2003 16:29:39 +0100 |
I have the bellow xml file and i want to load the next, with the bellow xslt code, but always presents me one great error: my pourpose is with the xslt file to format the xml file for loading one table with two cols. can you help me please? i am working with this problem durind two weeks and i cannot solve it. plese help me thanks thanks the XML file: <?xml version="1.0" encoding="ISO-8859-1"?> <registros> <votacion> <registro> <preguntaid>3</preguntaid> <valorrespuesta>1</valorrespuesta> <respuestanombre>Si</respuestanombre> <resultado>62</resultado> </registro> <registro> <preguntaid>3</preguntaid> <valorrespuesta>2</valorrespuesta> <respuestanombre>No</respuestanombre> <resultado>62</resultado> </registro> </votacion> <votacion> <registro> <preguntaid>1</preguntaid> <valorrespuesta>1</valorrespuesta> <respuestanombre>Si</respuestanombre> <resultado>62</resultado> </registro> <registro> <preguntaid>1</preguntaid> <valorrespuesta>2</valorrespuesta> <respuestanombre>No</respuestanombre> <resultado>34</resultado> </registro> <registro> <preguntaid>1</preguntaid> <valorrespuesta>3</valorrespuesta> <respuestanombre>Ns/Nc</respuestanombre> <resultado>27</resultado> </registro> </votacion> </registros> Tha XSL file: <?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="/registros"> <table> <tr> <td></td> <td></td> </tr> <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> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <xsl:for-each select="/registros/votacion/registro"> <tr align="left" valign="middle"> <td width="75" class="titulo3"><xsl:value-of select="/registros/votacion/registro[position()=$FirstItemPositionNo]/respue stanombre"/></td> <td> <xsl:variable name="myVarGrafica" select="/registros/votacion/registro/[position()=$FirstItemPositionNo]/resul tado" /> <img src="images/puntovotacion.gif" width="{$myVarGrafica}" height="10" /> </td> </tr> </xsl:for-each> </table> </td> <td> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <xsl:for-each select="registro"> <tr align="left" valign="middle"> <td width="75" class="titulo3"><xsl:value-of select="/registros/votacion/registro/[position()=$FirstItemPositionNo]+1/res puestanombre"/></td> <td> <xsl:variable name="myVarGrafica" select="/registros/votacion/registro/[position()=$FirstItemPositionNo+1]/res ultado" /> <img src="images/puntovotacion.gif" width="{$myVarGrafica}" height="10" /> </td> </tr> </xsl:for-each> </table> </td> </tr> </xsl:template> </xsl:stylesheet> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Determining the extension, bix xslt | Thread | Re: [xsl] two cols in one table (a , Dionisio Ruiz de Zar |
RE: [xsl] Embedding XSL in JavaScri, Mac Rost | Date | Re: [xsl] Re: Re: Creating a XSL to, Daniel Veillard |
Month |