Hi Simon,
I'm having a bit of a struggle with passing a subset of nodes around
in a xsl file. I have extracted a set of nodes that follow a XPath
rule where an attribute is set, and am paaaing this a a parameter to
a template.
<xsl:with-param name="image-nodes">
<xsl:value-of select="xalan:nodeset(.)/image[(_at_)position = 'left']" />
</xsl:with-param>
When you use the content of a variable-binding element
(<xsl:variable>, <xsl:param> or <xsl:with-param>), the result is a
result tree fragment -- a small tree that you can't further process.
If you want to set a variable/parameter to existing nodes (or to
simple values like numbers and strings) then you should use the select
attribute instead:
<xsl:with-param name="image-nodes"
select="xalan:nodeset(.)/image[(_at_)position = 'left']" />
By the way, I doubt that xalan:nodeset(.) is doing anything for you
here, since it's used to convert result tree fragments to node sets,
but the context node (.) cannot be a result tree fragment. I think
that just:
<xsl:with-param name="image-nodes"
select="image[(_at_)position = 'left']" />
will do what you want.
A quick scan through your stylesheet shows that you're using the
content of the variable-binding elements quite a lot when you should
be using the select attribute instead.
By the way, the latest version of Xalan supports exsl:node-set(),
which will work with other processors as well, so for portability it's
better to use exsl:node-set() than xalan:nodeset().
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list