xsl-list
[Top] [All Lists]

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

2020-07-21 09:10:24
Ihe Onwuka <ihe(_dot_)onwuka(_at_)gmail(_dot_)com> 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 you’re bumping up against a limitation in the xs:QName
constructor. See: 
https://www.w3.org/XML/Group/qtspecs/specifications/xpath-functions-31/html/Overview.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. You’ll 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(_at_)nwalsh(_dot_)com>
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
--~----------------------------------------------------------------
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
--~--

Attachment: signature.asc
Description: PGP signature

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