[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Variable containing tree


Subject: Re: [xsl] Variable containing tree
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 7 Jun 2002 13:17:20 +0100

Hi Filipe,

>>  (If you just want to copy the result, then use xsl:copy-of.)
>>  
>     It works, using xsl:copy-of I get the result I expected. thanks!
>     but using <apply-templates> should also work right?

Well, it depends on what your templates are doing. Templates don't
automatically copy nodes -- you have to create templates that do so,
for example an identity template like:

<xsl:template match="@* | node()">
  <xsl:copy>
    <xsl:apply-templates select="@* | node()" />
  </xsl:copy>
</xsl:template>

>>Note that $var/node() gives you a node set of the nodes under the
>>result tree fragment's root node; it appears as if these are the
>>nodes to which you wish to apply templates.
>
>    yes, those are the nodes i wanted to apply the templates to.
>    I've also tried to use $var/node() but I got the root node in the tree fragment.
>    My tree fragmente was something like this:
>
>       <node1>
>          <node2>
>             <node3/>
>             <node4/>
>          </node2>
>          <node5/>
>       </node1>
>
> so the result I got when invoquing <xsl:apply-templates
> select="$var/node()" /> was only <node1/> instead of the entire
> tree.

Then the templates that are being applied aren't doing what you want
them to do. You haven't shown us what your templates are, so we can't
tell why that is.

Cheers,

Jeni

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


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



Current Thread