Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


[xsl] How to access the root node from within a subtemplate/recursion?

From: "Matt Adams" <mattad@--------->
To:
Date: 12/1/2004 12:22:00 AM
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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent