[xsl] Re: [saxon] Use of QName forcing declaration "Unused" namespaces

Subject: [xsl] Re: [saxon] Use of QName forcing declaration "Unused" namespaces
From: "Norman Tovey-Walsh ndw@xxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 21 Jul 2020 14:10:17 -0000
Ihe Onwuka <ihe.onwuka@xxxxxxxxx> writes:
> 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:

I believe youbre bumping up against a limitation in the xs:QName
constructor. See:
https://www.w3.org/XML/Group/qtspecs/specifications/xpath-functions-31/html/O
verview.html#constructor-qname-notation

> 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>

Using fn:QName() instead of xs:QName() here will avoid the problem, I
believe. Youbll have to use *-from-QName() functions to get the URI and
local name (and prefix, if you care).

                                        Be seeing you,
                                          norm

--
Norman Tovey-Walsh <ndw@xxxxxxxxxx>
https://nwalsh.com/

> I often marvel that while each man loves himself more than anyone else,
> he sets less value on his own estimate than on the opinions of
> others.--Marcus Aurelius

[demime 1.01d removed an attachment of type application/pgp-signature which had a name of signature.asc]

Current Thread