Re: [xslt] Bug in exclude-result-prefixes?



Le 08/07/01 02:28:20, Daniel Veillard a écrit :
>   This section is unclear.

On the contrary, I think it's quite clear.

  7.1.1 Literal Result Elements
  [...]
  The created element node will also have a copy of the namespace nodes
  that were present on the element node in the stylesheet tree with the
  exception of any namespace node whose string-value is the XSLT
  namespace URI (http://www.w3.org/1999/XSL/Transform), a namespace URI
  declared as an extension namespace (see [14.1 Using Extension
  Elements]), or a namespace URI designated as an excluded namespace.

Only namespace nodes are concerned.

> Also I don't see how you can output the node if your are not allowed to
> generate a declaration for its namespace.

The output tree must be a well-formed external entity. One may want files
like these:
doc1.xml
<!DOCTYPE doc [
<!ENTITY e SYSTEM "doc2.xml">
]>
<doc xmlns:pre="prefix-URI">&e;</doc>

doc2.xml
<pre:elt/>

The resulting doc is a well-formed XML document and conforms to the XML
Names spec:
<...strip the doctype...>
<doc xmlns:pre="prefix-URI"><pre:elt/></doc>

doc2.xml is a well-formed external entity even without namespace
declaration.

>   The best would be to get someone to check with other XSLT processors
> (I don't have any installed) and report how they behave. I doubt it's
> just the namespace node, maybe it's just the elements in that namespace
> which are removed.

ptittom:~$ cat test.xml
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0" xmlns:prefix="http://foobar.com/prefix"
    exclude-result-prefixes="prefix">
<xsl:template match="/">
  <prefix:out/>
</xsl:template>
</xsl:stylesheet>

SAXON:
ptittom:~$ java com.icl.saxon.StyleSheet test.xml test.xml
<?xml version="1.0" encoding="utf-8"?><prefix:out
xmlns:prefix="http://foobar.com/prefix"/>

Xalan 2.0.0:
<?xml version="1.0" encoding="UTF-8"?>
<prefix:out xmlns:prefix="http://foobar.com/prefix"/>

Xalan 1.2.2:
ptittom:~$ java org.apache.xalan.xslt.Process
========= Parsing file:/home/ptittom/test.xml ==========
Parse of file:/home/ptittom/test.xml took 1104 milliseconds
========= Parsing file:/home/ptittom/test.xml ==========
Parse of file:/home/ptittom/test.xml took 124 milliseconds
=============================
Transforming...
<?xml version="1.0" encoding="ISO-8859-1"?>
<prefix:out/>
transform took 8 milliseconds
XSLProcessor: done

None of these XSLT processors strips element nodes, either they exclude the
namespace declaration (as I expected them to do) or they perform some
"namespace fixup" (adding back the removed namespace declaration, as the
dropped XSLT 1.1 WD said).
That's the way I interpret these results...

Tom.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]