xsl-list
[Top] [All Lists]

Re: [xsl] Using QNames as keys in maps

2018-02-15 03:51:13

 
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>

The expression xx means ./child::xx, it does not mean the QName ("", "xx"); and 
the same remains true if you write it as Q{}xx. Bare names in XPath expressions 
are short-hand for a selection on the child axis.

It's a shame that we didn't add a QName constructor function taking an EQName 
as input, something like QName("{}xx"); but that wouldn't be very much of a 
convenience over QName("", "xx") unless you are reading the EQName from 
somewhere else.

Michael Kay
Saxonica
 
--~----------------------------------------------------------------
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
--~--
<Prev in Thread] Current Thread [Next in Thread>