[Home] [By Thread] [By Date] [Recent Entries]
Thanks Andrew but that doesn't help me. I'm using 2.0.
Here is my test/use case, I have three files test.xml is the transformed document, include.xml is the included document and text.xsl is the XSL. test.xml: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="test.xsl"?> <document file="include.xml"> <extra type="introduction"><p>barfoo</p></extra> </document> include.xml: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="test.xsl"?> <document> <p> foobar </p> </document> test.xsl: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:key
match="extra"
name="extra"
use="@type"/> <xsl:template
match="extra"/>
<xsl:template
match="p">
<p>
<xsl:apply-templates/>
</p>
</xsl:template><xsl:template match="/document"> <xsl:choose> <xsl:when test="@file"> <!-- This works because the extra is in scope --> <xsl:for-each select="key('extra','introduction')"> <xsl:apply-templates select="child::node()"/> </xsl:for-each> <xsl:apply-templates select="doc(@file)"/> </xsl:when> <xsl:otherwise> <!-- But actually we wanted to pass the extra for use here in the second instance of "document" --> <xsl:for-each select="key('extra','introduction')"> <xsl:apply-templates select="child::node()"/> </xsl:for-each> <xsl:apply-templates/> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet> Your help appreciated. Sincerely, Steven On Jan 24, 2008, at 8:33 AM, Andrew Welch wrote: On 24/01/2008, Steven Ericsson-Zenith <steven@xxxxxxxxxxxxx> wrote:The first call to the root node stores a value in a key and the second
|

Cart



