[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Returning item type of variable (problems with maps)


Subject: [xsl] Returning item type of variable (problems with maps)
From: David Rudel <fwqhgads@xxxxxxxxx>
Date: Wed, 26 Mar 2014 23:57:30 +0100

Is there a simple way to report the type of a variable for de-bugging purposes?

In particular, I'm looking for a way to report the function signature
of a map because I'm getting an error that is very difficult for me to
be debug otherwise.

Here is what I have:

<xsl:variable name="daily.fact.map" as="map(xs:date,map(xs:string,xs:string*))">
    <xsl:map>
      Inside this function, there is an iterate instruction that spits out...
      <xsl:variable name="putative.map" as="map(xs:string,xs:string*)">
          <xsl:map>
            <xsl:for-each-group select="map:keys($fact.state.map)"
group-by="$list.map($fact.state.map(.))">
               <xsl:map-entry key="current-grouping-key()"
select="current-group()"/>
                  </xsl:for-each-group>
               </xsl:map>
       </xsl:variable>

       <xsl:map-entry key="xs:date($date)">
          <xsl:sequence select="$putative.map"/>
       </xsl:map-entry>
       ....
   </xsl:map>
</xsl:variable>

I am getting the error message

XTTE0570: Required item type of value of variable $daily.fact.map is
(map(xs:date, (map(xs:string, xs:string*))

This is not very helpful in terms of telling me what is going wrong.
I'd like to have the processor tell me what type of item it thinks is
being produced for $daily.fact.map is so I could figure out what is
the problem.

Note that, based on the definitions of the other maps, I don't
understand how there can be a problem:

<xsl:param name="fact.state.map" select="map:new()"
as="map(xs:string,xs:string)"/>

<xsl:variable name="list.map" as="map(xs:string,xs:string+)">

And since $putative.map is of required-type map(xs:string,xs:string*)
and is not flagged as an error, and xs:date($date) is not being
flagged as an error, then how can the <xsl:map-entry> instruction be
producing the wrong item type?

-David

-- 

"A false conclusion, once arrived at and widely accepted is not
dislodged easily, and the less it is understood, the more tenaciously
it is held." - Cantor's Law of Preservation of Ignorance.


Current Thread