#105 xsl:element fails with dynamic name

v7.3
closed
Michael Kay
7
2012-10-08
2002-11-21
Michael Kay
No

The instruction:
<xsl:element name="{$x}"/>

fails if $x contains no namespace prefix.

The error message is "namespace prefix has not been
declared".

Applies to Saxon 7.3 only.

I have fixed the source code; this bug is sufficiently
severe that I will probably issue a patch release to
fix it.

Test case added: nspc42. (I was rather shocked to
discover that none of my existing test cases covered
this area.)

The fix adds the following code at the end of
net.sf.saxon.instruct.NamespaceContext#getURIforPrefix():

    if (prefix.equals(&quot;&quot;) &amp;&amp; useDefault) {
        // use the &quot;default default namespace&quot; -

namely ""
return "";
} else {
return null;
}

Discussion

  • Michael Kay
    Michael Kay
    2002-12-10

    Logged In: YES
    user_id=251681

    Fixed in 7.3.1