Project

Profile

Help

Bug #2291 ยป Saxon_Debug_Iterator_at_Int.xsl

David Rudel, 2015-01-17 13:38

 
<?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:saxon="http://saxon.sf.net/"
xmlns:map="http://www.w3.org/2005/xpath-functions/map"
exclude-result-prefixes="xs saxon map">
<xsl:template match="/">

<xsl:variable name="sessions" select="//session"/>
<xsl:variable name="day.session.map" as="map(xs:integer,node()+)">
<xsl:map>
<xsl:map-entry key="1" select="$sessions[1]"/>
</xsl:map>
</xsl:variable>
<xsl:variable name="PG1.succession.info">
<xsl:iterate select="saxon:sort(map:keys($day.session.map))">
<xsl:param name="N" as="xs:double" select="0"/>
<xsl:param name="D" as="xs:double" select="0"/>
<xsl:param name="admins" as="xs:double" select="0"/>
<xsl:param name="promotions" as="xs:double" select="0"/>

<xsl:variable name="day.sessions" select="$day.session.map(.)"/>
<xsl:variable name="todays.N" select="+($day.sessions)[1]/@value"/>
<xsl:variable name="todays.D" select="+($day.sessions)[1]/@value"/>
<xsl:variable name="info" as="xs:double+">
<xsl:variable name="N.mid" select="round($N * 0.5)"/>
<xsl:variable name="D.mid" select="round($D * 0.5)"/>
<xsl:sequence select="(($todays.N - $N.mid) div 16,($todays.D - $D.mid) div 16)"/>
</xsl:variable>
<xsl:next-iteration>
<xsl:with-param name="admins" select="$info[2]"/>
<xsl:with-param name="promotions" select="$info[1]"/>
</xsl:next-iteration>
</xsl:iterate>
</xsl:variable>

<data>
<xsl:copy-of select="$PG1.succession.info"/>
</data>
</xsl:template>

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