[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
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:
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>
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
[xsl] Context node is within a variable - how to get back?
Subject: [xsl] Context node is within a variable - how to get back? From: "Tristan Stevens" <tristanstevens@xxxxxxxxxxx> Date: Fri, 29 Jun 2007 19:08:33 +0100 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Replacing default namespa, Martin Honnen | Thread | RE: [xsl] Context node is within a , Michael Kay |
[xsl] Replacing default namespace, Scott Sauyet | Date | Re: [xsl] XSL 2.0 and .NET and VB, Jirka Kosek |
Month |