Use of QName forcing declaration "Unused" namespaces
Ihe Onwuka <[email protected]>
| Newsgroups | gmane.text.xml.saxon.help,gmane.text.xml.xsl.general.mulberrytech |
|---|---|
| Message-ID | <CALfs7+z7i0zRh-J+seueu57-ppyWGQUFcH6U45pDQrc_3tPAxg@mail.gmail.com> |
Every element in my input doc is in one of 5 namespaces that I have
declared globally in the stylesheet. However the stylesheet as written
never explicitly references any of the 5 namespaces so I would like to
genericize it by doing away with the namespace declarations.
However if I remove any one of the namespaces I get this error.
Error at char 79 in expression in xsl:sequence/@select on line 14 column
118 of ***.xsl:
FONS0004 Namespace prefix {jx} has not been declared
at function local:localizedName on line 12 of ***.xsl:
Here is the function local:localizedName which is designed to return a
local name from a QName or a string.
<xsl:function name="local:localizedName" as="xs:string?">
<xsl:param name="name"/>
<xsl:sequence select="local-name-from-QName(if ($name instance of
xs:QName) then $name else xs:QName($name))"/>
</xsl:function>
It seems that casting anything as QName mandates that the namespace prefix
in whatever is being cast must be declared , even if it's not explicitly
referenced.
e.g xs:string(xs:QName($someName)) will fail if $someName contains 'ab:cde'
and you haven't declared the ab prefix anywhere (even if you don't
otherwise use it).
In which case my goal is better achieved by eradicating the QNames and
resorting to string manipulation to extract the local part of the name.
Comments, observations, corrections please.
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[email protected]
https://lists.sourceforge.net/lists/listinfo/saxon-help