[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Using QNames as keys in maps

Subject: Re: Using QNames as keys in maps
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 15 Feb 2018 09:51:00 -0000
Re:  Using QNames as keys in maps
Am 15.02.2018 um 10:28 schrieb Erik Siegel erik@xxxxxxxxxxx:
>
> Im trying to set up a map(xs:QName, item()), in an XSLT 3.0 
> stylesheet, but its 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 doesnt):
>
> <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>
>

If you use Q{}xx then you don't construct a QName, instead you select 
any xx children of the context node.

The only other option you have to construct a QName is xs:QName('xx').

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.