1.1 --- a/XSLForms/XSL/Prepare.xsl Sun Nov 29 02:01:41 2009 +0100
1.2 +++ b/XSLForms/XSL/Prepare.xsl Wed Feb 24 00:59:37 2010 +0100
1.3 @@ -4,7 +4,7 @@
1.4 stylesheet - something which is capable of transforming XML documents into Web
1.5 pages or other kinds of XML documents.
1.6
1.7 -Copyright (C) 2005, 2006, 2007, 2008 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2005, 2006, 2007, 2008, 2010 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 This program is free software; you can redistribute it and/or modify it under
1.11 the terms of the GNU Lesser General Public License as published by the Free
1.12 @@ -105,11 +105,15 @@
1.13 <xsl:choose>
1.14 <!-- Generate a reference to the previous element definition. -->
1.15 <xsl:when test="$recursive-element">
1.16 - <axsl:apply-templates select="{$first-name}" mode="{generate-id($recursive-element)}"/>
1.17 + <axsl:apply-templates select="{$first-name}" mode="{generate-id($recursive-element)}">
1.18 + <xsl:call-template name="element-sorting"/>
1.19 + </axsl:apply-templates>
1.20 </xsl:when>
1.21 <!-- Generate a reference to this element definition. -->
1.22 <xsl:otherwise>
1.23 - <axsl:apply-templates select="{$first-name}" mode="{generate-id(.)}"/>
1.24 + <axsl:apply-templates select="{$first-name}" mode="{generate-id(.)}">
1.25 + <xsl:call-template name="element-sorting"/>
1.26 + </axsl:apply-templates>
1.27 </xsl:otherwise>
1.28 </xsl:choose>
1.29 </xsl:otherwise>
1.30 @@ -127,7 +131,9 @@
1.31 <xsl:when test="$this-name != ''">
1.32 <!-- Produce a template with a mode. -->
1.33 <axsl:template match="{$this-name}" mode="{generate-id(.)}">
1.34 - <axsl:apply-templates select="{$next-name}" mode="{generate-id(.)}"/>
1.35 + <axsl:apply-templates select="{$next-name}" mode="{generate-id(.)}">
1.36 + <xsl:call-template name="element-sorting"/>
1.37 + </axsl:apply-templates>
1.38 </axsl:template>
1.39 <!-- Produce the other elements' templates... -->
1.40 <xsl:call-template name="element-template">
1.41 @@ -145,6 +151,12 @@
1.42 </xsl:choose>
1.43 </xsl:template>
1.44
1.45 + <xsl:template name="element-sorting">
1.46 + <xsl:if test="@template:sort">
1.47 + <axsl:sort select="{@template:sort}"/>
1.48 + </xsl:if>
1.49 + </xsl:template>
1.50 +
1.51
1.52
1.53 <!-- Match elements referencing selected sections. -->
1.54 @@ -335,7 +347,7 @@
1.55
1.56 <!-- Remove template attributes. -->
1.57
1.58 - <xsl:template match="@template:element|@template:init|@template:attribute|@template:value|@template:expr|@template:expr-attr|@template:effect|@template:if|@template:i18n|@template:copy|@template:select|@template:output">
1.59 + <xsl:template match="@template:element|@template:init|@template:attribute|@template:value|@template:expr|@template:expr-attr|@template:effect|@template:if|@template:i18n|@template:copy|@template:select|@template:output|@template:sort">
1.60 </xsl:template>
1.61
1.62