<!--
    Copyright (C) 2004 Orbeon, Inc.
  
    This program is free software; you can redistribute it and/or modify it under the terms of the
    GNU Lesser General Public License as published by the Free Software Foundation; either version
    2.1 of the License, or (at your option) any later version.
  
    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    See the GNU Lesser General Public License for more details.
  
    The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
-->
<xforms:model xmlns:xforms="http://www.w3.org/2002/xforms">
    <xforms:instance>
        <form>
<xslt>
&lt;!-- Return year(s) with max sale --&gt;
&lt;xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="2.0">
	&lt;xsl:template match="/">
	    &lt;xsl:variable name="max" as="xs:integer" select="max(for $y in /company/year return sum($y/quarter/@sales))"/>
	    &lt;xsl:copy-of select="/company/year[sum(quarter/@sales) = $max]"/>
    &lt;/xsl:template>
&lt;/xsl:transform></xslt>
        </form>
    </xforms:instance>
</xforms:model>

<!--
    Copyright (C) 2004 Orbeon, Inc.
  
    This program is free software; you can redistribute it and/or modify it under the terms of the
    GNU Lesser General Public License as published by the Free Software Foundation; either version
    2.1 of the License, or (at your option) any later version.
  
    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    See the GNU Lesser General Public License for more details.
  
    The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
-->
<xforms:model xmlns:xforms="http://www.w3.org/2002/xforms">
    <xforms:instance>
        <form>
<xslt>
&lt;!-- Return year(s) with max sale --&gt;
&lt;xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="2.0">
	&lt;xsl:template match="/">
	    &lt;xsl:variable name="max" as="xs:double" select="max(for $y in /company/year return sum($y/quarter/@sales))"/>
	    &lt;xsl:copy-of select="/company/year[sum(quarter/@sales) = $max]"/>
    &lt;/xsl:template>
&lt;/xsl:transform></xslt>
        </form>
    </xforms:instance>
</xforms:model>

Fix XSLT in sandbox that was not working with new Saxon
Fix XSLT in sandbox that was not working with new Saxon
