RE: [xsl] namespace value output at weird location

Subject: RE: [xsl] namespace value output at weird location
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 1 Apr 2005 09:25:56 +0100
> I guess what I don't understand, then, is why that
> namespace value didn't show up in the following lines(<li><br><ul>):
> 
> --------------
> TUTOR: Select Colors for House Painting<br 
> xmlns:jtt="http://mil.jcsj2t.jtt30";><ol 
> xmlns:jtt="http://mil.jcsj2t.jtt30";>
>    <li>Select one of the following:<br><ul>
> ----------

The <li> element has a namespace node for the jtt namespace - that is, the
jtt namespace is in scope for this element. Same applies to its <br> child.
But there's no need for a namespace declaration, because the namespace
declaration is already present on an ancestor element. 
> 
> So is "exclude-result-prefixes=" boilerplate then when 
> namespaces other than xsl are included in a stylesheet?

If you declare a namespace in the stylesheet because it's used in the source
document, and you don't want the namespace in the result document, then it
always makes sense to mention it in exclude-result-prefixes.

One thing to remember, however, is that the only effect of
exclude-result-prefixes is on literal result elements. If you copy elements
from the source document to the result document using xsl:copy-of, then all
their namespace nodes will be copied too, regardless of e-r-p.

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

Current Thread