1.1 --- a/XSLForms/XSL/PrepareMacro.xsl Mon Oct 03 00:54:19 2005 +0000
1.2 +++ b/XSLForms/XSL/PrepareMacro.xsl Mon Oct 03 15:48:32 2005 +0000
1.3 @@ -21,10 +21,23 @@
1.4 <!-- Text areas and other elements without value attributes. -->
1.5
1.6 <xsl:template match="*[@template:attribute-area]">
1.7 + <xsl:variable name="field-attr" select="substring-before(@template:attribute-area, ',')"/>
1.8 + <xsl:variable name="field-effect" select="substring-after(@template:attribute-area, ',')"/>
1.9 <xsl:copy>
1.10 - <!-- Remove attribute-field and replace name and value. -->
1.11 - <xsl:apply-templates select="@*[local-name() != 'attribute-area' and local-name() != 'name' and local-name() != 'value']"/>
1.12 - <xsl:attribute name="template:attribute"><xsl:value-of select="@template:attribute-area"/></xsl:attribute>
1.13 + <!-- Remove attribute-area and replace name. -->
1.14 + <xsl:apply-templates select="@*[local-name() != 'attribute-area' and local-name() != 'name']"/>
1.15 + <xsl:choose>
1.16 + <xsl:when test="$field-attr != ''">
1.17 + <xsl:attribute name="template:attribute"><xsl:value-of select="$field-attr"/></xsl:attribute>
1.18 + <xsl:if test="$field-effect != ''">
1.19 + <xsl:attribute name="template:effect"><xsl:value-of select="$field-effect"/></xsl:attribute>
1.20 + <xsl:attribute name="template:value">$this-value</xsl:attribute>
1.21 + </xsl:if>
1.22 + </xsl:when>
1.23 + <xsl:otherwise>
1.24 + <xsl:attribute name="template:attribute"><xsl:value-of select="@template:attribute-area"/></xsl:attribute>
1.25 + </xsl:otherwise>
1.26 + </xsl:choose>
1.27 <xsl:attribute name="name">{template:this-attribute()}</xsl:attribute>
1.28 <xsl:apply-templates select="*|node()"/>
1.29 </xsl:copy>
1.30 @@ -34,14 +47,17 @@
1.31
1.32 <xsl:template match="*[@template:attribute-button]">
1.33 <xsl:variable name="field-attr" select="substring-before(@template:attribute-button, ',')"/>
1.34 - <xsl:variable name="field-set-attr" select="substring-after(@template:attribute-button, ',')"/>
1.35 + <xsl:variable name="field-info" select="substring-after(@template:attribute-button, ',')"/>
1.36 + <xsl:variable name="field-value" select="substring-before($field-info, ',')"/>
1.37 + <xsl:variable name="field-set-attr" select="substring-after($field-info, ',')"/>
1.38 <xsl:copy>
1.39 <!-- Remove attribute-button and replace name. -->
1.40 <xsl:apply-templates select="@*[local-name() != 'attribute-button' and local-name() != 'name']"/>
1.41 <xsl:attribute name="template:attribute"><xsl:value-of select="$field-attr"/></xsl:attribute>
1.42 <xsl:attribute name="template:expr-attr"><xsl:value-of select="$field-set-attr"/></xsl:attribute>
1.43 - <xsl:attribute name="template:expr">$this-value != ''</xsl:attribute>
1.44 + <xsl:attribute name="template:expr">$this-value = '<xsl:value-of select="$field-value"/>'</xsl:attribute>
1.45 <xsl:attribute name="name">{template:this-attribute()}</xsl:attribute>
1.46 + <xsl:attribute name="value"><xsl:value-of select="$field-value"/></xsl:attribute>
1.47 <xsl:apply-templates select="*|node()"/>
1.48 </xsl:copy>
1.49 </xsl:template>
1.50 @@ -74,7 +90,9 @@
1.51 <xsl:copy>
1.52 <!-- Remove multiple-choice-field and replace name. -->
1.53 <xsl:apply-templates select="@*[local-name() != 'multiple-choice-field' and local-name() != 'name']"/>
1.54 - <xsl:attribute name="template:element"><xsl:value-of select="$field-element"/></xsl:attribute>
1.55 + <xsl:if test="$field-element != '-'">
1.56 + <xsl:attribute name="template:element"><xsl:value-of select="$field-element"/></xsl:attribute>
1.57 + </xsl:if>
1.58 <xsl:attribute name="name">{template:new-attribute('<xsl:value-of select="$field-attr"/>')}</xsl:attribute>
1.59 <xsl:apply-templates select="*|node()"/>
1.60 </xsl:copy>
1.61 @@ -90,7 +108,9 @@
1.62 <xsl:copy>
1.63 <!-- Remove multiple-choice-list-field and replace name. -->
1.64 <xsl:apply-templates select="@*[local-name() != 'multiple-choice-list-field' and local-name() != 'name']"/>
1.65 - <xsl:attribute name="template:element"><xsl:value-of select="$field-element"/></xsl:attribute>
1.66 + <xsl:if test="$field-element != '-'">
1.67 + <xsl:attribute name="template:element"><xsl:value-of select="$field-element"/></xsl:attribute>
1.68 + </xsl:if>
1.69 <xsl:attribute name="name">{template:list-attribute('<xsl:value-of select="$field-list-element"/>',
1.70 '<xsl:value-of select="$field-list-attr"/>')}</xsl:attribute>
1.71 <xsl:apply-templates select="*|node()"/>
2.1 --- a/XSLForms/XSL/Schema.xsl Mon Oct 03 00:54:19 2005 +0000
2.2 +++ b/XSLForms/XSL/Schema.xsl Mon Oct 03 15:48:32 2005 +0000
2.3 @@ -108,28 +108,50 @@
2.4 </selector>
2.5 </xsl:when>
2.6 <xsl:when test="@template:multiple-choice-field">
2.7 - <element type="multiple-choice">
2.8 - <xsl:variable name="field-element" select="substring-before(@template:multiple-choice-field, ',')"/>
2.9 - <xsl:variable name="field-attr" select="substring-after(@template:multiple-choice-field, ',')"/>
2.10 - <xsl:attribute name="name"><xsl:value-of select="$field-element"/></xsl:attribute>
2.11 - <attribute>
2.12 - <xsl:attribute name="name"><xsl:value-of select="$field-attr"/></xsl:attribute>
2.13 - </attribute>
2.14 - <xsl:apply-templates select="*"/>
2.15 - </element>
2.16 + <xsl:variable name="field-element" select="substring-before(@template:multiple-choice-field, ',')"/>
2.17 + <xsl:variable name="field-attr" select="substring-after(@template:multiple-choice-field, ',')"/>
2.18 + <xsl:choose>
2.19 + <xsl:when test="$field-element != '-'">
2.20 + <element type="multiple-choice">
2.21 + <xsl:attribute name="name"><xsl:value-of select="$field-element"/></xsl:attribute>
2.22 + <attribute>
2.23 + <xsl:attribute name="name"><xsl:value-of select="$field-attr"/></xsl:attribute>
2.24 + </attribute>
2.25 + <xsl:apply-templates select="*"/>
2.26 + </element>
2.27 + </xsl:when>
2.28 + <xsl:otherwise>
2.29 + <xsl:attribute name="type">multiple-choice</xsl:attribute>
2.30 + <attribute>
2.31 + <xsl:attribute name="name"><xsl:value-of select="$field-attr"/></xsl:attribute>
2.32 + </attribute>
2.33 + <xsl:apply-templates select="*"/>
2.34 + </xsl:otherwise>
2.35 + </xsl:choose>
2.36 </xsl:when>
2.37 <xsl:when test="@template:multiple-choice-list-field">
2.38 - <element type="multiple-choice-list">
2.39 - <xsl:variable name="field-element" select="substring-before(@template:multiple-choice-list-field, ',')"/>
2.40 - <xsl:variable name="field-list-info" select="substring-after(@template:multiple-choice-list-field, ',')"/>
2.41 - <xsl:variable name="field-list-element" select="substring-before($field-list-info, ',')"/>
2.42 - <xsl:variable name="field-list-attr" select="substring-after($field-list-info, ',')"/>
2.43 - <xsl:attribute name="name"><xsl:value-of select="$field-element"/></xsl:attribute>
2.44 - <attribute>
2.45 - <xsl:attribute name="name"><xsl:value-of select="$field-list-attr"/></xsl:attribute>
2.46 - </attribute>
2.47 - <xsl:apply-templates select="*"/>
2.48 - </element>
2.49 + <xsl:variable name="field-element" select="substring-before(@template:multiple-choice-list-field, ',')"/>
2.50 + <xsl:variable name="field-list-info" select="substring-after(@template:multiple-choice-list-field, ',')"/>
2.51 + <xsl:variable name="field-list-element" select="substring-before($field-list-info, ',')"/>
2.52 + <xsl:variable name="field-list-attr" select="substring-after($field-list-info, ',')"/>
2.53 + <xsl:choose>
2.54 + <xsl:when test="$field-element != '-'">
2.55 + <element type="multiple-choice-list">
2.56 + <xsl:attribute name="name"><xsl:value-of select="$field-element"/></xsl:attribute>
2.57 + <attribute>
2.58 + <xsl:attribute name="name"><xsl:value-of select="$field-list-attr"/></xsl:attribute>
2.59 + </attribute>
2.60 + <xsl:apply-templates select="*"/>
2.61 + </element>
2.62 + </xsl:when>
2.63 + <xsl:otherwise>
2.64 + <xsl:attribute name="type">multiple-choice-list</xsl:attribute>
2.65 + <attribute>
2.66 + <xsl:attribute name="name"><xsl:value-of select="$field-list-attr"/></xsl:attribute>
2.67 + </attribute>
2.68 + <xsl:apply-templates select="*"/>
2.69 + </xsl:otherwise>
2.70 + </xsl:choose>
2.71 </xsl:when>
2.72 <xsl:when test="@template:multiple-choice-value">
2.73 <element type="multiple-choice-value">