[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Inconsistent interpretation of // relative to document()


Subject: [xsl] Inconsistent interpretation of // relative to document()
From: Richard Hoberman <richard.hoberman@xxxxxxxxxxxxx>
Date: Wed, 22 Aug 2007 12:42:11 +0100

I get different results when using Saxon to merge two documents,
depending on whether I invoke Saxon via Ant or via JAXP.

The difference appears to be how "//" is interpreted while processing
nodes obtained using document().  The Ant version finds nodes in the
source document (as opposed to the one obtained via the function).  The
JAXP version finds nodes among those returned by the document function.

Which is the correct behaviour?  (Also, is there a name for "//"?)
 
I am using Saxon-8.9B, Sun JDK 1.6, XSLT 2.  My stylesheet is below.

Regards

Richard Hoberman


<xsl:stylesheet version="2.0"
                xmlns="http://www.w3.org/1999/XSL/Format"
                xmlns:c="http://www.sadalbari.com/2007/FO/Composition"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:param name="template-source" />
   
    <xsl:variable name="template" select="document($template-source)/*" />
   
    <xsl:template match="c:composition">
        <xsl:apply-templates select="$template" mode="insert" />
    </xsl:template>
   
    <xsl:template match="c:insert" mode="insert">
        <xsl:variable name="name" select="@name" />
        <xsl:apply-templates select="//c:define[@name=$name]/node()"
mode="insert" />       
    </xsl:template>
   
    <xsl:template match="@*|node()" mode="insert">
      <xsl:copy>
        <xsl:apply-templates select="@*|node()" mode="insert" />
      </xsl:copy>
    </xsl:template>
   
    <xsl:template match="@*|node()" mode="copy">
      <xsl:copy>
        <xsl:apply-templates select="@*|node()" mode="copy" />
      </xsl:copy>
    </xsl:template>
   
    <xsl:template match="*" />

</xsl:stylesheet>


Current Thread
Keywords