xsl-list
[Top] [All Lists]

[xsl] accessing xml using node name

2006-05-17 09:08:12
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 Câmara de Oliveira
viniciuscamara(_at_)yahoo(_dot_)com(_dot_)br


                
_______________________________________________________ Novo Yahoo! Messenger com voz: Instale agora e faça ligações de graça. http://br.messenger.yahoo.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>