|
Subject: [xsl] Constructing a Map Using xsl:for-each-group From: "Eliot Kimber ekimber@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 25 May 2018 23:05:48 -0000 |
I want to construct a map where the keys are attribute values and the entries contain the elements that exhibit those attribute values. The obvious way to do this is with for-each-group:
<xsl:variable name="links-by-target-id" as="map(xs:string, element()*)">
<xsl:map>
<xsl:for-each-group select="$docbook-links" group-by="@linkend">
<map:entry key="{current-grouping-key()}">
<xsl:sequence select="current-group()"/>
</map:entry>
</xsl:for-each-group>
</xsl:map>
</xsl:variable>
However, using Saxon 9.8.0.8 from Oxygen I get this message:
"Required item type of xsl:map sequence constructor is map(*); supplied value (xsl:for-each-group) has item type element(). The expression can succeed only if the supplied value is an empty sequence."
The XSLT spec says that the contents of <xsl:map> is a sequence constructor, which for-each-group certainly is.
Is this message legit? I don't see how it can be but maybe I'm missing a subtlety in the map instruction?
Thanks,
Eliot
--
Eliot Kimber
http://contrext.com
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] How to access PSVI in XSL, Mukul Gandhi gandhi. | Thread | Re: [xsl] Constructing a Map Using , Michael Kay mike@xxx |
| Re: [xsl] How to access PSVI in XSL, Mukul Gandhi gandhi. | Date | Re: [xsl] Constructing a Map Using , Michael Kay mike@xxx |
| Month |