DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27579>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27579

xmlns:* attributes copied incorrectly in literal result element





------- Additional Comments From [EMAIL PROTECTED]  2004-03-10 19:34 -------
I don't believe this is a bug.  You're missing several important points:

1. Namespace declarations are not attributes, and they do get special treatment.

2. The node <my-element> _also_ has a namespace node which it gets from the 
corresponding namespace declaration in the stylesheet element, so the 
serializer generates a namespace declaration for it.

3. Xalan's serializer is deciding how namespace declarations should be 
generated, which is a different process from the conceptual generation of the 
result tree, which is the part of the recommendation you're referring to.

If you try just about any other XSLT processor on your test case, you'll find 
they all generate the same result.

One way to force the behavior you're looking for is to remove the namespace 
declaration from the stylesheet element, and place it on the literal result 
element where you want it to appear.  This works in some cases, but not all.

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

<xsl:output method='xml'/>

<xsl:template match='/' >
  <my-element>
    <inner-element aaa:attr='value' xmlns:aaa='my namespace URI'>
      This is my content
    </inner-element>
</my-element>
</xsl:template>

</xsl:stylesheet>

In general, you can't expect a serialization mechanism that's designed to 
generate a well-formed document (or an external general parsed entity in the 
case of XSLT) to generate it in such a way that you can pull out a chunk of 
markup and have it be well-formed.

Reply via email to