[xsl] accessing xml using node name

Subject: [xsl] accessing xml using node name
From: <viniciuscamara@xxxxxxxxxxxx>
Date: Wed, 17 May 2006 13:11:00 -0300
Hello,
So, I'd a question and I'll try to explain and make the question correctly. So, let's go to the principal target.
I'm using the Javascript to pass to my xsl params:


1) xslt.setParameter(null, "rows", "nmeDesempenho, vlrMinimo, vlrMaximo"); <!--PASSING THE NODE NAME-->
2) xslt.setParameter(null, "rows", "3, 4, 5"); <!--PASSING THE NODE POSITION-->


When I pass the nodes names(3) with params I don't succeed to get nodes values, with another way a guess (2).
I saw the example accessing node name at: http://www.stylusstudio.com/xsllist/200604/post10450.html by Mr Michael Kay.
At example works fine, but I don't manage this to more than one node.
Are there another XPATH to run this perfectly?


Thanks a lot,
Have a I nice day,

<xsl:template name="displayRows">
<xsl:param name="list"/>
<xsl:param name="id"/>
<xsl:variable name="columnRow" select="substring-before($list,',')"/>
<xsl:choose>
<xsl:when test="string-length($columnRow) > 0">
<td>
<!--WORKS FINE THAT IF MY COLLECTION PARAMS CONTAIN THE NUMBER COLUMNS-->
<xsl:value-of select="self::node()/node()[number($columnRow)]"/><br />


<!--WORKS ONLY THE FIRST TIME IF MY PARAM CONTAIN THE NODE NAME-->
<xsl:value-of select="self::node()/node()[name() = $columnRow]"/>
</td>


<xsl:call-template name="displayRows">
<xsl:with-param name="list"><xsl:value-of select="substring-after($list,',')"/></xsl:with-param>
<xsl:with-param name="id"><xsl:value-of select="$id"/></xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<td>
<xsl:value-of select="self::node()/node()[number($list)]"/>
<xsl:value-of select="self::node()/node()[name() = $list]"/>
</td>
<td style="text-align:center;">
<img onclick="getGridRowData(XML_GRID, '{name()}', '{$id}');"
src="images/common/icons/edit.gif" align="absmiddle" class="toolbar hand"/>&#160;
<img onclick="deleteGridRowData(XML_GRID, '{name()}', '{$id}');"
src="images/common/icons/delete.gif" align="absmiddle" class="toolbar hand"/>
</td>
</xsl:otherwise>
</xsl:choose>
</xsl:template>



<!--PARAM--> <xsl:param name="rows" />

<!--CALL THE TEMPLATE DISPLAY ROWS--->
<xsl:for-each select="root/*">
 <xsl:call-template name="displayRows">
 <xsl:with-param name="list" select="$rows"/>
 <xsl:with-param name="id"><xsl:value-of select="@id" /></xsl:with-param>
 </xsl:call-template>
</xsl:for-each>


Vinicius Cbmara de Oliveira viniciuscamara@xxxxxxxxxxxx



_______________________________________________________ Novo Yahoo! Messenger com voz: Instale agora e faga ligagues de graga. http://br.messenger.yahoo.com/


Current Thread