[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Convert string to a list of nodes

Subject: RE: Convert string to a list of nodes
From: Alexandra Duda <oladuda@xxxxxxxxx>
Date: 05 Dec 2001 09:24:57 +0100
convert string to variable name
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.