xsl-list
[Top] [All Lists]

RE: [xsl] xslt 1.0 namespace on output doc

2006-04-12 09:35:25

should get transformed by:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
                      xmlns="http://www.w3.org/1999/xhtml";
                      xmlns:xhtml="http://www.w3.org/1999/xhtml";

<snip/> 
                        
<xsl:template match="/">
      <html lang="de" xml:lang="de">

into the following xhtml (apart from white-space, and well, not really

<snip/>

<html xmlns="http://www.w3.org/1999/xhtml"; lang="de" xml:lang="de">

<snip/>


But only Transformiix (Fx 1.5.01) gives me the expected 
result, whereas
SAXON 6.5.5 and MSXML 3 both add
xmlns:xhtml="http://www.w3.org/1999/xhtml";
to the html element.

With XSLT 1.0, the majority are usually in the right. The specification says
that for a literal result element (such as <html>) all namespace nodes that
are in-scope for that element in the stylesheet are copied to the result
document. This includes the namespace node that maps the prefix "xhtml" to
the URI "http://www.w3.org/1999/xhtml"; 

You might be able to prevent this happening with exclude-result-prefixes.
This isn't guaranteed to work, however: some processors will ignore the
exclude-result-prefixes if the namespace in question is one that is actually
used in the result tree. This is conformant behavior because XSLT 1.0
basically says the serializer can add any namespaces it wants. By contrast,
the behavior you are seeing from Transformiix appears to be non-conformant.

Michael Kay
http://www.saxonica.com/




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>