[XSL-LIST Mailing List Archive Home]
Re: paths starting with "//" are invariant?
Subject: Re: paths starting with "//" are invariant?|
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 20 Dec 1999 09:42:59 GMT
> in the second occurence, i was inside a template which was applied to the
> result of a xt:node-set call.
I'm sure you're over-using this node-set extension (and causing yourself
problems:-) The point of node-set() is to get back a result so that
you can apply more templates over it, so being able to essentially apply
a chain of two stylesheets within the same actual stylesheet instance.
You said in an earlier message
> Because it is the select phrase that i want to re-use, not the processing:
> there are 3 different kinds of processing that i want to do to the
> node set described by the god-awful select phrase.
> in effect, i want to say something like:
But I still don't really understand the requirement.
Given a large select expression (such as, for example "a|b") it seems
there are three thing one might want to save and re-use:
1) the expression itself
so if XXX = "a|b"
you could do select="XXX" and get the a or b children of the current
2) The input nodes correspoinding to using that select expression at a
particular point in the input tree.
This xsl supports, you just go
<xsl:variable name="x" select="a|b" />
and then $x gives you access to these nodes at any point in the
3) the result tree fragment resulting from doing a particular set
of transformations on the input nodes selected by the expression.
This again is supported
<xsl:apply-templates select="a|b" />
Note that in this case the reult in the variable might have no
relation to the select expression at all, the templates might just
produce "Merry Christmas" on any input.
I _think_ that what you want is (1) which isn't directly supported
and you are trying to fake it with (3) combined with an identity
transformation, so the result tree looks similar to the input, and a
node-set() extenson function to convert it back to the input nodes.
But that seems to be a long way round and gets you something equivalent
to (2). So I am confused as to what you _do_ want.
The nearest you can get to (1( is to make named templates that use the
expression in an apply-templates, and get different effects at different
times by passing different parameters to the templates.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list