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

How to access the root node from within a subtemplate

Subject: How to access the root node from within a subtemplate/recursion?
From: "Matt Adams" <mattad@xxxxxxxxx>
Date: Wed, 01 Dec 2004 01:21:37 +0100
xslt subtemplate
Obviously xslt only knows the local tree at the current recursion level.
Is there a way to access the root node of the whole outer tree?

Assume the following (simplified) tree:

<names>
  <myelem name="paul">
    <ref name="karl" />
  </myelem>
  <myelem name="peter">
    <ref name="karl" />
  </myelem>
  <myelem name="karl">
    <ref name="tony" />
  </myelem>
</names>

The (simplified) XSLT stylesheet looks like:

....
<xsl:template match="//myelem[@name = 'peter']">
  <xsl:call-template name="myrule">
     <xsl:with-param name="nametofind" select="ref[@name]" />
  </xsl:call-template>
</xsl:template>
...

<xsl:template name="myrule">
  <!-- at the first call $nametofind contains 'karl' -->
  <xsl:param name="nametofind" />
  <xsl:call-template name="myrule">
     <!-- now I want to jump to the node <myelem name="karl"> with the subnode
'tony'
          but this doesn't work because this node is outside the context/scope
-->
     <xsl:with-param name="nametofind" select="//myelem[@name = $nametofind]"
/>
  </xsl:call-template>

</xsl:template>


How do I access from a given subtree the outer whole tree resp. other nodes?

Thank you
Matt

--
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm

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.