1.1 --- a/XSLForms/XSL/PrepareMacro.xsl Sat Jun 21 01:38:50 2008 +0200
1.2 +++ b/XSLForms/XSL/PrepareMacro.xsl Sun Dec 11 21:45:19 2005 +0000
1.3 @@ -127,13 +127,15 @@
1.4 </xsl:template>
1.5
1.6 <!-- Multiple choice fields, represented by menus and listboxes. -->
1.7 - <!-- Format: element,attribute[,attribute-type] -->
1.8 + <!-- Format: element,attribute[,attribute-type|,attribute-type,source-type] -->
1.9
1.10 <xsl:template match="*[@template:multiple-choice-field]">
1.11 <xsl:variable name="field-element" select="substring-before(@template:multiple-choice-field, ',')"/>
1.12 <xsl:variable name="field-attr-info" select="substring-after(@template:multiple-choice-field, ',')"/>
1.13 <xsl:variable name="field-attr" select="substring-before($field-attr-info, ',')"/>
1.14 - <xsl:variable name="field-attr-type" select="substring-after($field-attr-info, ',')"/>
1.15 + <xsl:variable name="field-attr-type-info" select="substring-after($field-attr-info, ',')"/>
1.16 + <xsl:variable name="field-attr-type" select="substring-before($field-attr-type-info, ',')"/>
1.17 + <xsl:variable name="field-source-type" select="substring-after($field-attr-type-info, ',')"/>
1.18 <xsl:copy>
1.19 <!-- Remove multiple-choice-field and replace name. -->
1.20 <xsl:apply-templates select="@*[local-name() != 'multiple-choice-field' and local-name() != 'name']"/>
1.21 @@ -141,7 +143,7 @@
1.22 <xsl:attribute name="template:element"><xsl:value-of select="$field-element"/></xsl:attribute>
1.23 </xsl:if>
1.24 <xsl:choose>
1.25 - <xsl:when test="$field-attr-type = 'new'">
1.26 + <xsl:when test="$field-attr-type = 'new' or field-attr-type = '' and $field-attr-type-info = 'new'">
1.27 <xsl:attribute name="name">{template:new-attribute('<xsl:value-of select="$field-attr"/>')}</xsl:attribute>
1.28 </xsl:when>
1.29 <xsl:when test="$field-attr = ''">
1.30 @@ -158,21 +160,31 @@
1.31 </xsl:template>
1.32
1.33 <!-- Multiple choice list fields, represented by menus and listboxes with multiple values. -->
1.34 - <!-- Format: element,list-element,list-attribute -->
1.35 + <!-- Format: element,list-element,list-attribute[,source-type] -->
1.36
1.37 <xsl:template match="*[@template:multiple-choice-list-field]">
1.38 <xsl:variable name="field-element" select="substring-before(@template:multiple-choice-list-field, ',')"/>
1.39 <xsl:variable name="field-list-info" select="substring-after(@template:multiple-choice-list-field, ',')"/>
1.40 <xsl:variable name="field-list-element" select="substring-before($field-list-info, ',')"/>
1.41 - <xsl:variable name="field-list-attr" select="substring-after($field-list-info, ',')"/>
1.42 + <xsl:variable name="field-list-attr-info" select="substring-after($field-list-info, ',')"/>
1.43 + <xsl:variable name="field-list-attr" select="substring-before($field-list-attr-info, ',')"/>
1.44 + <xsl:variable name="field-source-type" select="substring-after($field-list-attr-info, ',')"/>
1.45 <xsl:copy>
1.46 <!-- Remove multiple-choice-list-field and replace name. -->
1.47 <xsl:apply-templates select="@*[local-name() != 'multiple-choice-list-field' and local-name() != 'name']"/>
1.48 <xsl:if test="$field-element != '-'">
1.49 <xsl:attribute name="template:element"><xsl:value-of select="$field-element"/></xsl:attribute>
1.50 </xsl:if>
1.51 - <xsl:attribute name="name">{template:list-attribute('<xsl:value-of select="$field-list-element"/>',
1.52 - '<xsl:value-of select="$field-list-attr"/>')}</xsl:attribute>
1.53 + <xsl:choose>
1.54 + <xsl:when test="$field-list-attr != ''">
1.55 + <xsl:attribute name="name">{template:list-attribute('<xsl:value-of select="$field-list-element"/>',
1.56 + '<xsl:value-of select="$field-list-attr"/>')}</xsl:attribute>
1.57 + </xsl:when>
1.58 + <xsl:otherwise>
1.59 + <xsl:attribute name="name">{template:list-attribute('<xsl:value-of select="$field-list-element"/>',
1.60 + '<xsl:value-of select="$field-list-attr-info"/>')}</xsl:attribute>
1.61 + </xsl:otherwise>
1.62 + </xsl:choose>
1.63 <xsl:apply-templates select="*|node()"/>
1.64 </xsl:copy>
1.65 </xsl:template>