Error message to reconsider

Ihe Onwuka <[email protected]> Fri, 2 Oct 2020 15:01:50 -0400
Newsgroups gmane.text.xml.saxon.help
Message-ID <CALfs7+xXO=muiz=ZB6qg4+B96H8TPE8f1e=BkFf6EP8v42_aYw@mail.gmail.com>
This is a  reprefixing function. It takes a qualified name, strips off the
prefix and looks up the namespace for the prefix using the variable
containing the root element as it's context. Having got the namespace it is
supposed to decode that in a map to a preferred prefix.

   <xsl:variable name="fRePrefix" as="function(xs:string) as xs:string"
                 select="function($name as xs:string) as xs:string {

 namespace-uri-for-prefix(substring-before($name,':'),$root) => $nsMap() ||
':'
                         }"/>

The call fails because the namespace I am looking up isn't in scope on the
root so it doesn't pass anything to the map which is represented by a
global variable $nsMap. The problem is the error message which you might
want to look at.

Type error at char 111 in expression in xsl:variable/@select on line 35
column 31 of test.xsl:
  XPTY0004  An empty sequence is not allowed as the second argument of
map:get()
at function anon:f_1617838096 on line 0
     invoked by unknown caller (class
net.sf.saxon.functions.hof.UserFunctionReference$BoundUserFunction)
at function anon:f_1617838096 on line 0
An empty sequence is not allowed as the second argument of map:get()

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[email protected]
https://lists.sourceforge.net/lists/listinfo/saxon-help