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()"/>