1.1 --- a/XSLForms/XSL/PrepareMacro.xsl Mon Oct 03 15:48:32 2005 +0000
1.2 +++ b/XSLForms/XSL/PrepareMacro.xsl Mon Oct 03 19:09:50 2005 +0000
1.3 @@ -86,14 +86,28 @@
1.4
1.5 <xsl:template match="*[@template:multiple-choice-field]">
1.6 <xsl:variable name="field-element" select="substring-before(@template:multiple-choice-field, ',')"/>
1.7 - <xsl:variable name="field-attr" select="substring-after(@template:multiple-choice-field, ',')"/>
1.8 + <xsl:variable name="field-attr-info" select="substring-after(@template:multiple-choice-field, ',')"/>
1.9 + <xsl:variable name="field-attr" select="substring-before($field-attr-info, ',')"/>
1.10 + <xsl:variable name="field-attr-type" select="substring-after($field-attr-info, ',')"/>
1.11 <xsl:copy>
1.12 <!-- Remove multiple-choice-field and replace name. -->
1.13 <xsl:apply-templates select="@*[local-name() != 'multiple-choice-field' and local-name() != 'name']"/>
1.14 <xsl:if test="$field-element != '-'">
1.15 <xsl:attribute name="template:element"><xsl:value-of select="$field-element"/></xsl:attribute>
1.16 </xsl:if>
1.17 - <xsl:attribute name="name">{template:new-attribute('<xsl:value-of select="$field-attr"/>')}</xsl:attribute>
1.18 + <xsl:choose>
1.19 + <xsl:when test="$field-attr-type = 'new'">
1.20 + <xsl:attribute name="name">{template:new-attribute('<xsl:value-of select="$field-attr"/>')}</xsl:attribute>
1.21 + </xsl:when>
1.22 + <xsl:when test="$field-attr = ''">
1.23 + <xsl:attribute name="template:attribute"><xsl:value-of select="$field-attr-info"/></xsl:attribute>
1.24 + <xsl:attribute name="name">{template:this-attribute()}</xsl:attribute>
1.25 + </xsl:when>
1.26 + <xsl:otherwise>
1.27 + <xsl:attribute name="template:attribute"><xsl:value-of select="$field-attr"/></xsl:attribute>
1.28 + <xsl:attribute name="name">{template:this-attribute()}</xsl:attribute>
1.29 + </xsl:otherwise>
1.30 + </xsl:choose>
1.31 <xsl:apply-templates select="*|node()"/>
1.32 </xsl:copy>
1.33 </xsl:template>