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

Re: AW: AW: [xsl] Using key() from outside the default namespace


Subject: Re: AW: AW: [xsl] Using key() from outside the default namespace
From: Peter Flynn <peter@xxxxxxxxxxx>
Date: 12 Aug 2003 23:29:15 +0100

On Fri, 2003-08-08 at 16:48, Markus Abt wrote:

> Honest, the "trigger problem" is not here, but in (2) below.
> 
> >> (2) In your format template, you use this variable (via the param of
> >> the same name):
> >>         <xsl:apply-templates select="$content"/>
> >
> >Right, because $content may contain further subelements which need
> >matching in templates.
> 
> No, it does only contain one root node and one text node, since the
> value-of doesn't return the whole tree but only the first text node.

Duh. I should have seen that coming. I'd forgotten I *wasn't* retrieving
the key value via the select attribute of xsl-variable. Grrr. Thanks.

> If you use copy-of instead of value-of, then the variable $content will
> contain a result tree fragment with all subelements.
[...]
> Then, you can either
> -  use <xsl:copy-of select="$content"/> here to copy the result
>    tree fragment to the output *without processing*, or

No, I do need to apply templates to the subelement content...

> -  use <xsl:apply-templates select="xx:node-set($content)/node()"/>
>    to first convert the result tree fragment to a node set, and then
>    apply templates to the resulting node-set.
>    Note the .../node() here, to avoid "firing" of the root template...

...but oddly, if I use copy-of, it appears to treat the result tree 
fragment as a node set without the need for exsl:node-set, because it 
ends up applying templates to the subelement content rather than 
passing it unchanged as I would have expected with copy-of. In other
words, subelements in $content do get transformed correctly. Strange.

> >It looks as if it simply isn't possible in XSLT transparently to
> >revisit a document like this to retrieve a key value. 
> 
> No, it is, via a node-set() extension function.

Unfortunately the downloads from http://www.exslt.org/download.html
don't actually contain the required file, exsl.node-set.xsl (it's
not in either exsl.zip nor all-exslt.zip

Does anyone know where it is available from?

///Peter



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



Current Thread
Keywords