[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Passing the current node list

Subject: Re: Passing the current node list
From: Joerg Pietschmann <joerg.pietschmann@xxxxxx>
Date: Wed, 22 Aug 2001 10:36:05 +0200
Re:  Passing the current node list
"Paul Ackley" <Paul.Ackley@xxxxxxxxx> 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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.