This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Passing the current node list
- To: XSL List <xsl-list at lists dot mulberrytech dot com>
- Subject: Re: [xsl] Passing the current node list
- From: Joerg Pietschmann <joerg dot pietschmann at zkb dot ch>
- Date: Wed, 22 Aug 2001 10:36:05 +0200
- Organization: ZKB
- Reply-To: xsl-list at lists dot mulberrytech dot com
"Paul Ackley" <Paul.Ackley@qwest.com> wrote:
> I would like to know how (or if I even can) pass the current location in the
> XML tree from template to template?
One possibility is to pass the node as a parameter:
<!-- template to be invoked -->
<xsl:template match="foo">
<xsl:param name="original-node"/>
<!-- refer to $original-node for your node -->
</xsl:template>
<!-- invokation -->
<xsl:template match="bar">
<xsl:apply-templates select="document('foo')/foo">
<xsl:with-param name="original-node" select="."/>
</xsl:apply-templates>
</xsl:template>
Be aware that parameters are not passed through built-in
templates, they will be dropped without notice. If necessary,
define a catch-all template:
<xsl:template match="*">
<xsl:param name="original-node"/>
<xsl:apply-templates>
<xsl:with-param name="original-node" select="."/>
</xsl:apply-templates>
</xsl:template>
If you have already a catch-all, or if you are using modes,
you may have to do more work.
There are probably other methods to achieve the effect you want
which may be easier to handle in your context.
HTH
J.Pietschmann
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list