Project

Profile

Help

Bug #2041 ยป NPE_public_Repro.xsl

David Rudel, 2014-03-26 14:05

 
<?xml version="1.0" encoding="UTF-8" ?>

<xsl:stylesheet version="3.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xdt="http://www.w3.org/2005/xpath-datatypes"
xmlns:saxon="http://saxon.sf.net/"
xmlns:map="http://www.w3.org/2005/xpath-functions/map"
exclude-result-prefixes="xs xdt saxon map">

<xsl:variable name="list.map" as="map(xs:string,xs:string+)">
<xsl:map>
<xsl:map-entry key="'TARGET_READY'" select="('tr','a')"/>
</xsl:map>
</xsl:variable>
<xsl:variable name="sorted.factstamps" as="node()*">
<a factID="31" operationalState="TARGET_READY" date="2013-10-21"/>
</xsl:variable>
<xsl:template match="/">
<xsl:variable name="daily.fact.map" as="map(xs:string,xs:string*)">
<xsl:map>
<xsl:iterate select="$sorted.factstamps">
<xsl:param name="fact.state.map" as="map(xs:string,xs:string)"/>
<xsl:param name="date" select="'2013-10-20'" as="xs:string"/>
<xsl:variable name="new.date" select="@date"/>
<xsl:for-each-group select="map:keys($fact.state.map)" group-by="$list.map($fact.state.map(.))">
<xsl:map-entry key="$date||current-grouping-key()" select="current-group()"/>
</xsl:for-each-group>
<xsl:next-iteration>
<xsl:with-param name="fact.state.map" select="map:new(($fact.state.map,map{@factID := @operationalState}))"/>
<xsl:with-param name="date" select="$new.date"/>
</xsl:next-iteration>
</xsl:iterate>
</xsl:map>
</xsl:variable>
<xsl:value-of select="count(map:keys($daily.fact.map))"/>

</xsl:template>

</xsl:stylesheet>
    (1-1/1)