Re: [xsl] Differing behavior of Xalan and Saxon with namespaces.Who's right?

Subject: Re: [xsl] Differing behavior of Xalan and Saxon with namespaces.Who's right?
From: "Roger L. Costello" <costello@xxxxxxxxx>
Date: Thu, 13 Mar 2003 15:26:33 -0500
Thanks Niko.  I gave your suggestion a try - I used a literal result
element, as shown here:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:fit="http://www.keeping-fit.org";
                version="1.0">
 
    <xsl:output method="xml"/>

    <xsl:template match="FitnessCenter">
        <FitnessCenter>
            <xsl:apply-templates/>
        </FitnessCenter>
    </xsl:template>

    <xsl:template match="*">
        <xsl:element name="{name(.)}">
            <xsl:for-each select="@*">
                <xsl:attribute name="{name(.)}">
                    <xsl:value-of select="."/>
                </xsl:attribute>
            </xsl:for-each>
            <xsl:apply-templates/>
        </xsl:element>
    </xsl:template>

</xsl:stylesheet>

However, I got the same result - Xalan carried the namespace declaration
over, and Saxon did not.  /Roger



Niko Matsakis wrote:
> 
> > Both Xalan and Saxon are correct.  True, the Xalan output declares an
> > extra namespace, but the FitnessCenter element does not belong to that
> > namespace. So the presence of the declaration has no effect on the
> > interpretation of the document.
> 
> Not strictly true.  Depending on how the FitnessCenter element was
> created (literal result element vs xsl:element vs xsl:copy) the XSLT
> processor is obliged to copy over different sets of namespace bindings;
> there is some vagueness in the spec when it comes to xsl:element, but it
> is clear for literal result elements and xsl:copy.  In the former case,
> the namespace bindings from the stylesheet should be output, and in the
> latter the bindings from the input.
> 
> Unfortunately, without seeing the rest of the stylesheet in question we
> can't say if either processor is wrong.  I'm going to guess that they're
> both right and that the author is using an xsl:element or xsl:copy; if
> so, I'd suggest to Roger that he create the FitnessCenter element with
> an LRE in which case I'm sure both saxon and xalan will output the
> correct bindings.
> 
> Niko Matsakis
> 
> --
> DataPower technology
> http://www.datapower.com
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread