1.1 --- a/XSLForms/XSL/Input.xsl Mon Oct 03 23:06:16 2005 +0000
1.2 +++ b/XSLForms/XSL/Input.xsl Tue Oct 04 00:56:10 2005 +0000
1.3 @@ -17,7 +17,7 @@
1.4 <axsl:output indent="yes"/>
1.5
1.6 <!-- Make document parameters for all elements appearing to use enumerations. -->
1.7 - <xsl:for-each select="//element[*/@expr]">
1.8 + <xsl:for-each select="//element[@type='multiple-choice' or @type='multiple-choice-list']">
1.9 <axsl:param name="{@name}"/>
1.10 </xsl:for-each>
1.11
1.12 @@ -30,7 +30,7 @@
1.13 <xsl:apply-templates select="*"/>
1.14
1.15 <!-- Replicate unknown elements. -->
1.16 - <axsl:template match="@*|node()">
1.17 + <axsl:template match="@*|placeholder|node()">
1.18 <axsl:copy>
1.19 <axsl:apply-templates select="@*|node()"/>
1.20 </axsl:copy>
1.21 @@ -55,16 +55,12 @@
1.22 <axsl:apply-templates select="@*"/>
1.23
1.24 <!-- Find elements and determine how to process them. -->
1.25 - <xsl:for-each select="element">
1.26 - <xsl:call-template name="process-element"/>
1.27 - </xsl:for-each>
1.28 + <xsl:call-template name="process-elements"/>
1.29 </xsl:element>
1.30 </axsl:template>
1.31
1.32 <!-- Make rules for nested elements. -->
1.33 - <xsl:for-each select="element">
1.34 - <xsl:call-template name="process-rules"/>
1.35 - </xsl:for-each>
1.36 + <xsl:call-template name="process-rules"/>
1.37
1.38 </xsl:template>
1.39
1.40 @@ -72,35 +68,35 @@
1.41
1.42 <!-- Process elements. -->
1.43
1.44 - <xsl:template name="process-element">
1.45 - <xsl:param name="path" select="@name"/>
1.46 + <xsl:template name="process-elements">
1.47 + <xsl:param name="path">.</xsl:param>
1.48
1.49 - <!-- Define elements which do not have selectors. -->
1.50 - <xsl:variable name="adding-selectors" select="count(//selector[@element=current()/@name])"/>
1.51 + <xsl:for-each select="element">
1.52 + <!-- Define elements which do not have selectors. -->
1.53 + <xsl:variable name="adding-selectors" select="count(//selector[@element=current()/@name])"/>
1.54
1.55 - <xsl:choose>
1.56 - <!-- Enumerations. -->
1.57 - <xsl:when test="@type='multiple-choice-value' or @type='multiple-choice-list-value'">
1.58 - <xsl:call-template name="inside-enumeration">
1.59 - <xsl:with-param name="path" select="$path"/>
1.60 - </xsl:call-template>
1.61 - </xsl:when>
1.62 - <!-- Added elements. -->
1.63 - <xsl:when test="$adding-selectors = 0">
1.64 - <xsl:element name="{@name}">
1.65 - <axsl:apply-templates select="{$path}/@*"/>
1.66 - <xsl:for-each select="element">
1.67 - <xsl:call-template name="process-element">
1.68 + <xsl:choose>
1.69 + <!-- Enumerations. -->
1.70 + <xsl:when test="@type='multiple-choice-value' or @type='multiple-choice-list-value'">
1.71 + <xsl:call-template name="inside-enumeration">
1.72 + <xsl:with-param name="path" select="concat($path, '/', @name)"/>
1.73 + </xsl:call-template>
1.74 + </xsl:when>
1.75 + <!-- Added elements. -->
1.76 + <xsl:when test="$adding-selectors = 0">
1.77 + <xsl:element name="{@name}">
1.78 + <axsl:apply-templates select="{$path}/{@name}/@*"/>
1.79 + <xsl:call-template name="process-elements">
1.80 <xsl:with-param name="path" select="concat($path, '/', @name)"/>
1.81 </xsl:call-template>
1.82 - </xsl:for-each>
1.83 - </xsl:element>
1.84 - </xsl:when>
1.85 - <!-- Other elements are only added if found. -->
1.86 - <xsl:otherwise>
1.87 - <axsl:apply-templates select="{$path}"/>
1.88 - </xsl:otherwise>
1.89 - </xsl:choose>
1.90 + </xsl:element>
1.91 + </xsl:when>
1.92 + <!-- Other elements are only added if found. -->
1.93 + <xsl:otherwise>
1.94 + <axsl:apply-templates select="{$path}/{@name}|{$path}/placeholder"/>
1.95 + </xsl:otherwise>
1.96 + </xsl:choose>
1.97 + </xsl:for-each>
1.98 </xsl:template>
1.99
1.100
1.101 @@ -108,27 +104,27 @@
1.102 <!-- Process rules. -->
1.103
1.104 <xsl:template name="process-rules">
1.105 - <xsl:param name="path" select="@name"/>
1.106 -
1.107 - <!-- Define elements which do not have selectors. -->
1.108 - <!-- NOTE: Duplicating adding-selectors - see above. -->
1.109 - <xsl:variable name="adding-selectors" select="count(//selector[@element=current()/@name])"/>
1.110 + <xsl:param name="path">.</xsl:param>
1.111
1.112 - <xsl:choose>
1.113 - <xsl:when test="@type='multiple-choice-value' or @type='multiple-choice-list-value'">
1.114 - <!-- Do not match multiple-choice values. -->
1.115 - </xsl:when>
1.116 - <xsl:when test="$adding-selectors = 0">
1.117 - <xsl:for-each select="element">
1.118 + <xsl:for-each select="element">
1.119 + <!-- Define elements which do not have selectors. -->
1.120 + <!-- NOTE: Duplicating adding-selectors - see above. -->
1.121 + <xsl:variable name="adding-selectors" select="count(//selector[@element=current()/@name])"/>
1.122 +
1.123 + <xsl:choose>
1.124 + <xsl:when test="@type='multiple-choice-value' or @type='multiple-choice-list-value'">
1.125 + <!-- Do not match multiple-choice values. -->
1.126 + </xsl:when>
1.127 + <xsl:when test="$adding-selectors = 0">
1.128 <xsl:call-template name="process-rules">
1.129 <xsl:with-param name="path" select="concat($path, '/', @name)"/>
1.130 </xsl:call-template>
1.131 - </xsl:for-each>
1.132 - </xsl:when>
1.133 - <xsl:otherwise>
1.134 - <xsl:apply-templates select="."/>
1.135 - </xsl:otherwise>
1.136 - </xsl:choose>
1.137 + </xsl:when>
1.138 + <xsl:otherwise>
1.139 + <xsl:apply-templates select="."/>
1.140 + </xsl:otherwise>
1.141 + </xsl:choose>
1.142 + </xsl:for-each>
1.143 </xsl:template>
1.144
1.145
1.146 @@ -136,7 +132,7 @@
1.147 <!-- Fill in enumerations. -->
1.148
1.149 <xsl:template name="inside-enumeration">
1.150 - <xsl:param name="path" select="@name"/>
1.151 + <xsl:param name="path"/>
1.152
1.153 <!-- Store multiple-choice selections, if appropriate. -->
1.154 <xsl:if test="../@type='multiple-choice-list'">