1.1 --- a/XSLForms/XSL/Input.xsl Fri Oct 14 16:05:16 2005 +0000
1.2 +++ b/XSLForms/XSL/Input.xsl Sun Oct 16 22:38:33 2005 +0000
1.3 @@ -88,6 +88,10 @@
1.4 <xsl:template name="process-elements">
1.5 <xsl:param name="path">.</xsl:param>
1.6
1.7 + <!-- To ensure "stable ordering" of elements, the initialised/static elements are
1.8 + added first; the collection/dynamic elements are added afterwards. This may not
1.9 + necessarily match the schema, however. -->
1.10 +
1.11 <xsl:for-each select="element">
1.12 <!-- Define elements which do not have selectors. -->
1.13 <xsl:variable name="adding-selectors" select="count(//selector[@element=current()/@name])"/>
1.14 @@ -108,6 +112,26 @@
1.15 </xsl:call-template>
1.16 </xsl:element>
1.17 </xsl:when>
1.18 + <!-- Other elements are only added if found and must appear last - see below. -->
1.19 + <xsl:otherwise/>
1.20 + </xsl:choose>
1.21 + </xsl:for-each>
1.22 +
1.23 + <!-- Add the collection/dynamic elements at the end. This includes placeholder
1.24 + elements which may have represented the static elements.
1.25 + NOTE: We may wish to exclude placeholder elements in any situation where static
1.26 + NOTE: elements are employed, since the only place where keeping them around is
1.27 + NOTE: necessary/meaningful is in dynamic element collections. -->
1.28 +
1.29 + <xsl:for-each select="element">
1.30 + <!-- Define elements which do not have selectors. -->
1.31 + <xsl:variable name="adding-selectors" select="count(//selector[@element=current()/@name])"/>
1.32 +
1.33 + <xsl:choose>
1.34 + <!-- Enumerations added first - see above. -->
1.35 + <xsl:when test="@type='multiple-choice-value' or @type='multiple-choice-list-value'"/>
1.36 + <!-- Added elements added first - see above. -->
1.37 + <xsl:when test="(not(@init) or @init = 'auto') and $adding-selectors = 0 or @init = 'yes'"/>
1.38 <!-- Other elements are only added if found. -->
1.39 <xsl:otherwise>
1.40 <axsl:apply-templates select="{$path}/{@name}|{$path}/placeholder"/>