xsl-list
[Top] [All Lists]

Re: [xsl] Namespace Appearing for No Obvious Reason: What Could Cause It?

2015-03-04 12:33:50
The issue does appear to have been a missing exclude-result-prefixes. My
initial check was bad (I must be getting old).

Using this XPath search across all the XSLT modules I found modules that
declared the namespace but did not omit the prefix:

/xsl:stylesheet[not(contains(@exclude-result-prefixes,
'df'))][namespace-uri-for-prefix('df', .)]

Adding the prefix to @exclude-result-prefixes corrected the issue.

Cheers,

E.
—————
Eliot Kimber, Owner
Contrext, LLC
http://contrext.com




On 3/4/15, 11:45 AM, "Martin Honnen martin(_dot_)honnen(_at_)gmx(_dot_)de"
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

Eliot Kimber ekimber(_at_)contrext(_dot_)com wrote:
I am generating HTML from a fairly complex transform made of many
modules.
These modules declare a number of namespaces that apply to different
function packages, module-specific named templates and modes, etc., but
*not* to either the input elements or result elements (other than
possible
an XHTML namespace). I have checked and all of these namespaces are
accounted for in the exclude-result-prefixes declarations for all the
modules involved.

In my transform I'm calling this template, which then applies the
following template:

<xsl:template name="generateMetaBrand">
   <xsl:apply-templates select="." mode="generateMetaBrand"/>
     </xsl:template>

     <xsl:template match="*" mode="generateMetaBrand">
   <meta name="brand" content="XXXX"/>
   <xsl:value-of select="$newline"/>
     </xsl:template>

The resulting element has an unwanted namespace declaration:


<meta xmlns:df="http://dita2indesign.org/dita/functions"; name="brand"
content="XXXX"></meta>

The namespace in question is associated with functions and nothing else.
The namespace is only declared on <xsl:stylesheet> elements and the
prefix
is not used on any start tag.

I can't think of anything that would cause this namespace, and only this
namespace (out of the several that are declared on each stylesheet), to
be
output in the HTML.

What could cause this sort of rogue namespace declaration?

The normal explanation is that the namespace declaration is in scope for
the literal result element, meaning it is declared on the xsl:stylesheet
or xsl:transform of the stylesheet module and exclude-result-prefixes in
that module does not list the prefix "df".

I realize you say that exclude-result-prefixes is present but if it
really is, then it looks like a bug of the XSLT processor.


--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

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