RE: [xsl] Convert string to a list of nodes

Subject: RE: [xsl] Convert string to a list of nodes
From: Alexandra Duda <oladuda@xxxxxxxxx>
Date: 05 Dec 2001 09:22:08 +0100
Hello Jeff,

>>>Now I only want to know the way to get a node which name I have listed in
>string parameter passed to a template. This is the main problem for me now.
>
>you mean like this?
>
>...
><xsl:param name="the-name"/>
><xsl:variable name="the-value">
>	<xsl:copy-of select="//*[local-name()=$the-name]"/>
></xsl:variable> 
>...

Almost... ;-)
I used your trick with recursion and finally my problem is solved. 

Inside my "table_template" now I call recursive template, that builds 
specified row structure.

<xsl:variable name="separator">;</xsl:variable>

<xsl:template name="build_table_rows">
 <xsl:param name="node_list"/>
 <xsl:variable name="a_node_name"
 select="substring-before($node_list,$separator)"/>

 <xsl:call-template name="row_template">
   <!-- this is the template, I used to create one table row.
   I can pass some parameters to this template and everything 
   works fine -->
   <xsl:with-param name="nodename">
     <xsl:value-of select="$a_node_name"/>
   </xsl:with-param>
   <xsl:with-param name="nodevalue">
    <xsl:value-of select="//*[local-name()=$a_node_name]"/>
   </xsl:with-param>
   ...
 </xsl:call-template> 
 
 <xsl:if test="substring-after($node_list,$separator)!=''">
  <xsl:call-template name="build_table_rows">
    <xsl:with-param name="node_list"><xsl:value-of
    select="substring-after($node_list,$separator)"/></xsl:with-param>
  </xsl:call-template>
 </xsl:if>

</xsl:template>

Now I have exactly what I wanted: one, easy-to-configure template for all
tables. I can call this template several times and create a table that contains data from nodes I specified.

Thanks a lot for your help and patience ;-)

Alexandra

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread