RE: [xsl] xslt node-set variable transversal

Subject: RE: [xsl] xslt node-set variable transversal
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Tue, 30 Mar 2004 22:46:02 +0200
> -----Original Message-----
> From: Kyle Partridge [mailto:kpartridge@xxxxxxxxxxxx]
>
> I've got an xpath that narrows a set of all the regions in the document,
> to the set of regions in a single "column":
>
> <xsl:variable name="col-regions" select="//ws:region[parent::ws:regions
> and @left&gt;0 and (@left+@width)&lt;$useable-page-width]"/>
>
> Then, I'm trying to iterate over that set:
<snip />
>
> but this doesn't work - the XMLSpy debugger says I am not getting
> anything in these params.
>

Hi,

I'm unsure what kind of solution is appropriate, mainly because we don't get
to see what actually happens inside the 'horizontal-region-block' mode
template.

However, there seems to be something rather awkward about the structure

<xsl:for-each select="$nodes">
  ...
  <xsl:apply-templates select="." mode="different-mode">
    <xsl:with-param name="pprec" select="preceding-sibling::*" />
    <xsl:with-param name="pfoll" select="following-sibling::*" />
  </xsl:apply-templates>

</xsl:for-each>

which seems more or less what you're trying to do.

The reason for my thinking so is the fact that the preceding- and
following-sibling axes will *per se* be available from within the matching
template, since the context node will be changed by the
apply-templates --I'm absolutely dazzled as to why you would want to pass
these in as parameters...

The above just needs to become:
<xsl:apply-templates select="$nodes">
  <xsl:with-param name="pparam" select="expr" />
</xsl:apply-templates>

where the param is used to collect data which is easily accessible from the
context surrounding the apply-templates, but won't be too easily reachable
from within the context of the matching template.


Hope this gives you an idea (or two)!

Cheers,

Andreas

Current Thread