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

Context node is within a variable - how to get back?

Subject: Context node is within a variable - how to get back?
From: "Tristan Stevens" <tristanstevens@xxxxxxxxxxx>
Date: Fri, 29 Jun 2007 19:08:33 +0100
 Context node is within a variable - how to get back?
Hi,
I have a problem which I am currently solving using a temporary tree within a variable, which I thought would allow me to process the contents of my document multiple times.


For example:

<Root>
   <IncompleteCopyInformation>
       <Copy attr1="a" attr2="b"/>
       <Copy attr1="c" attr2="d"/>
       <Copy attr1="e" attr2="f"/>
   </
   <Body>
       <h1>...</h1>
   </
</

In my scenario, the CopyInformation isn't quite good enough, therefore I need to run some XSLT to get some more information - this I stored in a variable, which I then iterate through to provide multiple copies of the body itself:

<xsl:variable name="Copies">
<CopyList>
<xsl:apply-templates select="/Root/IncompleteCopyInformation" mode="ListGeneration" />
</CopyList>
</xsl:variable>


<xsl:tempalte match="Copy" mode="ListGeneration">
   <ActualCopy>
       ... <!-- some logic going on here -->
   </ActualCopy>
</xsl:template>

<xsl:template match="/">
   <xsl:apply-templates select="$Copies"/>
</xsl:template>

<xsl:template match="ActualCopy">
   <h1>Copy <xsl:number ... /></h1>
   <xsl:apply-templates select="/Root/Body">
       <xsl:param .... />
   </xsl:apply-templates>
</xsl:template>

This doesn't work because when I attempt to apply-templates to /Root/Body, the context appears to be limited to the variable - how can I get back to the document?


This is largely academic, as I found a way around it by moving the copy derivation code into a massive XPath, however interested to know if there is a solution.


Thanks,

Tristan

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.