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

Re: AW: variables

Subject: Re: AW: variables
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 31 May 2001 14:11:53 +0100
Re: AW:  variables
Hi André,

> In your "evaluate-paths"-template you used the <xsl:copy-of>
> instruction in order to return a copy of the result nodes (s. a) )
> which will be the RTF of the "var1-rtf" variable. Is this right ? I
> thought that the result of the <xsl:copy-of> instruction would be
> copied directly into the result-tree. Could you please give me an
> answer to that question.

The result tree is the result of processing the entire stylesheet -
that's what gets output ultimately.

If you set a variable (or parameter) using its content then you get a
'result tree fragment' - a bit of a result tree that you might
completely ignore or you might copy to the result, perhaps multiple
times. Creating nodes while setting the value of a variable, however
you do it, including using xsl:copy-of, doesn't make those nodes
automatically appear in the result tree.

Actually, if you're going down the copying route you don't have to use
recursion to evaluate the paths, you could use xsl:for-each instead:

   <xsl:variable name="var1-rtf">
      <!-- store the current node in $data -->
      <xsl:variable name="data" select="." />
      <!-- iterate over the paths -->
      <xsl:for-each select="document('doc2.xml')/paths/*">
         <!-- store the current path in $path -->
         <xsl:variable name="path" select="." />
         <!-- change context back to $data -->
         <xsl:for-each select="$data">
            <!-- make a copy of the result of evaluating the path -->
            <xsl:copy-of select="xalan:evaluate($path)" />
         </xsl:for-each>
      </xsl:for-each>
   </xsl:variable>
   <xsl:variable name="var1" select="xalan:nodeSet($var1-rtf)" />

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 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.