You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Sc...@lotus.com on 2001/03/11 21:42:40 UTC

attribset23 questionable behavior

Not sure I trust the attribset23 behavior.  It is different for XT, Saxon,
and Xalan.  Any opinions?

== xsl ==
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version
="1.0">

  <!-- FileName: attribset23 -->
  <!-- Document: http://www.w3.org/TR/xslt -->
  <!-- DocVersion: 19991116 -->
  <!-- Section: 7.1.3 Creating Attributes -->
  <!-- Creator: Paul Dick -->
  <!-- Purpose: XSLT processors may make use of the prefix of the QNAME
specified
       in the name attribute ... however they are not required to do so
and, if
       the prefix is xmlns, they must not do so ... this will not result in
a
       namespace declaration being output. -->

<xsl:template match="/">
 <root>
  <Out>
     <xsl:attribute name="xmlns:xsl" namespace
="whatever">http://www.w3.org/1999/XSL/Transform</xsl:attribute>
  </Out>
 </root>
</xsl:template>

</xsl:stylesheet>

== gold file (and Xalan) ==
<?xml version="1.0" encoding="UTF-8"?>
<root><Out xmlns:ns0="whatever" ns0:xsl
="http://www.w3.org/1999/XSL/Transform"/></root>

== XT ==
<?xml version="1.0" encoding="utf-8"?>
<root><Out xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xmlns
="whatever"/></root>

== Saxon ==
Recoverable error at line 17
Invalid attribute name: xmlns:xsl
<?xml version="1.0" encoding="utf-8"?><root><Out/></root>


Thoughts?

-scott




Re: attribset23 questionable behavior

Posted by Gary L Peskin <ga...@firstech.com>.
Scott_Boag@lotus.com wrote:
> 
> Not sure I trust the attribset23 behavior.  It is different for XT, Saxon,
> and Xalan.  Any opinions?

Scott --

I agree with the Xalan version of the output for attribset23.  This
exact example is shown in section 7.1.3 of XSLT 1.0 in the following
paragraph:

"XSLT processors may make use of the prefix of the QName specified in
the name attribute when selecting the prefix used for outputting the
created attribute as XML; however, they are not required to do so and,
if the prefix is xmlns, they must not do so. Thus, although it is not an
error to do:

<xsl:attribute name="xmlns:xsl"
namespace="whatever">http://www.w3.org/1999/XSL/Transform</xsl:attribute>

it will not result in a namespace declaration being output."

The Recommendation specifically says that this is not an error so the
Saxon behavior is wrong in my view.  Similary, XT outputs nonsense since
it defines no attributes other than namespace attributes which the
Recommendation specifically prohibits.  Xalan properly adds the
attribute with the local name "xsl" using a proper declaration for the
namespace URI.

With what part of the Xalan output do you disagree?

Garay

> 
> == xsl ==
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version
> ="1.0">
> 
>   <!-- FileName: attribset23 -->
>   <!-- Document: http://www.w3.org/TR/xslt -->
>   <!-- DocVersion: 19991116 -->
>   <!-- Section: 7.1.3 Creating Attributes -->
>   <!-- Creator: Paul Dick -->
>   <!-- Purpose: XSLT processors may make use of the prefix of the QNAME
> specified
>        in the name attribute ... however they are not required to do so
> and, if
>        the prefix is xmlns, they must not do so ... this will not result in
> a
>        namespace declaration being output. -->
> 
> <xsl:template match="/">
>  <root>
>   <Out>
>      <xsl:attribute name="xmlns:xsl" namespace
> ="whatever">http://www.w3.org/1999/XSL/Transform</xsl:attribute>
>   </Out>
>  </root>
> </xsl:template>
> 
> </xsl:stylesheet>
> 
> == gold file (and Xalan) ==
> <?xml version="1.0" encoding="UTF-8"?>
> <root><Out xmlns:ns0="whatever" ns0:xsl
> ="http://www.w3.org/1999/XSL/Transform"/></root>
> 
> == XT ==
> <?xml version="1.0" encoding="utf-8"?>
> <root><Out xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xmlns
> ="whatever"/></root>
> 
> == Saxon ==
> Recoverable error at line 17
> Invalid attribute name: xmlns:xsl
> <?xml version="1.0" encoding="utf-8"?><root><Out/></root>
> 
> Thoughts?
> 
> -scott

-- 
Gary L Peskin
The Firstech Corporation
+1.323.658.1146
http://www.simdate.com