Re: [xsl] recursivly applying a transform to a result tree

Subject: Re: [xsl] recursivly applying a transform to a result tree
From: "M.A. Voetberg" <marco@xxxxxxxxxxxx>
Date: Mon, 9 Apr 2001 13:24:30 +0200
> This works with processors which support XSLT1.1, for example with
> Saxon 6.2.2.  NB, XSLT 1.1 is not a recommendation yet.  For other
> processors you may be able to use the extension function node-set().
> Is this of any help?
> Regards,
> Trevor Nash


This does help. At least I can get my example to work with:

<xsl:stylesheet version="1.0"

<xsl:template match="a">
    <xsl:apply-templates />

<xsl:template match="modifyA>
  <xsl:variable name="tree">
  <xsl:apply-templates select="$tree" />

<xsl:template match="b/c">
    <xsl:apply-templates />


So that <a/> gives <b><c/><b>,
and <modifyA><a/></modifyA> gives <d />

But this gives the next problem that if the input already has b/c it also
will be transformed to <d />. This
I solved by using mode="tree" in the <xml:apply templates select="$tree" />
and the
<xsl:templates match="b/c">.

It works, but I'm not really charmed about the solution. I also read
something in the XSLT1.1 spec that the result tree fragments were going to
be removed ? But I'm not sure (I'm not getting any response from so I can't look it up). If they remove this feature, I hope they
will add a slightly more elegant way to apply templates to result tree


Marco Voetberg

 XSL-List info and archive:

Current Thread