[xsl] Using QNames as keys in maps

Subject: [xsl] Using QNames as keys in maps
From: "Erik Siegel erik@xxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 15 Feb 2018 09:27:49 -0000
Hi,

 

I'm trying to set up a map(xs:QName, item()), in an XSLT 3.0 stylesheet, but
it's very inconvenient. This works:

(Running in  oXygen 19.1 which reports Saxon 9.7.0.19, tried both PE and EE)

 

<xsl:template match="/">

    <xsl:variable name="qmap" as="map(xs:QName, item())" select="map{
QName((), 'xx'): 'aaa' }"/>

    <RESULT size="{map:size($qmap)}">

      <xsl:value-of select="map:get($qmap, QName((), 'xx'))"/>

    </RESULT>

</xsl:template>

 

 

But I would have expected this to work also (but it doesn't):

 

<xsl:template match="/">

  <xsl:variable name="qmap" as="map(xs:QName, item())" select="map{ Q{}xx:
'aaa' }"/>

  <RESULT size="{map:size($qmap)}">

    <xsl:value-of select="map:get($qmap, Q{}xx)"/>

  </RESULT>

</xsl:template>

 

Or even this (although I understand that this would introduce ambiguities)?

 

<xsl:template match="/">

  <xsl:variable name="qmap" as="map(xs:QName, item())" select="map{ xx:
'aaa' }"/>

  <RESULT size="{map:size($qmap)}">

    <xsl:value-of select="map:get($qmap, xx)"/>

  </RESULT>

</xsl:template>

 

Is this is a matter of waiting for a new Saxon release or is my
understanding flawed? Anybody out there that knows something about this?

 

Thanks,

Erik Siegel

Current Thread