- Fixed coercion bug with global paper-year parameter.
1 parent fb2eaf4 commit c95b270a989ac23d62f6453f072b9284c6573e2e
nstanger authored on 20 Jun 2012
Showing 1 changed file
View
14
modules/global-elements.xml
@offset: Output the year +/- some integer value. The input value is truncated and defaults to zero if not supplied.
-->
<template name="PaperYear" match="PaperYear">
<common>
<xsl:variable name="add">
<xsl:value-of select="floor(@offset)" />
<xsl:if test="not(@offset)">0</xsl:if>
<xsl:variable name="add" as="xs:integer">
<xsl:value-of select="if ( @offset ) then floor( @offset ) else 0" />
</xsl:variable>
<xsl:value-of select="$paper-year + $add" />
<!--
It appears that we need an explicit type cast for $paper-year to keep everyone happy?!?! Even if you declare $paper-year to be xs:integer, XML Exchanger Editor still thinks you can't add a string ($paper-year) to an integer ($add). Stupid.
-->
<xsl:value-of select="xs:integer( $paper-year ) + $add" />
</common>
</template>
 
<template name="PaperYear-strip" match="PaperYear" mode="strip">