1.1 --- a/XSLForms/XSL/Input.xsl Sat Jun 21 01:38:50 2008 +0200
1.2 +++ b/XSLForms/XSL/Input.xsl Sun Dec 11 21:45:19 2005 +0000
1.3 @@ -233,21 +233,31 @@
1.4 </xsl:if>
1.5
1.6 <!-- Select inside the enumeration source, inside an element with the field's name, the enumeration elements. -->
1.7 - <!-- NOTE: We could avoid dyn:evaluate if we were certain that a document reference was being used. -->
1.8 - <!-- NOTE: However, we may want to be able to refer to other places within the document, and this requires -->
1.9 - <!-- NOTE: some dynamic evaluation. -->
1.10 - <axsl:for-each select="dyn:evaluate(${../@name})/{../@name}/{@name}">
1.11 - <axsl:copy>
1.12 - <axsl:apply-templates select="@*"/>
1.13 - <xsl:if test="@type='multiple-choice-list-value'">
1.14 - <axsl:if test="$values-{@name}[string() = current()/@{attribute/@name}]">
1.15 - <axsl:attribute name="{@expr-name}">true</axsl:attribute>
1.16 - </axsl:if>
1.17 - </xsl:if>
1.18 - <!-- Include child nodes, if provided. -->
1.19 - <axsl:copy-of select="node()"/>
1.20 - </axsl:copy>
1.21 - </axsl:for-each>
1.22 + <xsl:choose>
1.23 + <xsl:when test="../@source='dynamic'">
1.24 + <axsl:for-each select="dyn:evaluate(${../@name})/{../@name}/{@name}">
1.25 + <xsl:call-template name="inside-enumeration-element"/>
1.26 + </axsl:for-each>
1.27 + </xsl:when>
1.28 + <xsl:otherwise>
1.29 + <axsl:for-each select="${../@name}/{../@name}/{@name}">
1.30 + <xsl:call-template name="inside-enumeration-element"/>
1.31 + </axsl:for-each>
1.32 + </xsl:otherwise>
1.33 + </xsl:choose>
1.34 + </xsl:template>
1.35 +
1.36 + <xsl:template name="inside-enumeration-element">
1.37 + <axsl:copy>
1.38 + <axsl:apply-templates select="@*"/>
1.39 + <xsl:if test="@type='multiple-choice-list-value'">
1.40 + <axsl:if test="$values-{@name}[string() = current()/@{attribute/@name}]">
1.41 + <axsl:attribute name="{@expr-name}">true</axsl:attribute>
1.42 + </axsl:if>
1.43 + </xsl:if>
1.44 + <!-- Include child nodes, if provided. -->
1.45 + <axsl:copy-of select="node()"/>
1.46 + </axsl:copy>
1.47 </xsl:template>
1.48
1.49 </xsl:stylesheet>
2.1 --- a/XSLForms/XSL/PrepareMacro.xsl Sat Jun 21 01:38:50 2008 +0200
2.2 +++ b/XSLForms/XSL/PrepareMacro.xsl Sun Dec 11 21:45:19 2005 +0000
2.3 @@ -127,13 +127,15 @@
2.4 </xsl:template>
2.5
2.6 <!-- Multiple choice fields, represented by menus and listboxes. -->
2.7 - <!-- Format: element,attribute[,attribute-type] -->
2.8 + <!-- Format: element,attribute[,attribute-type|,attribute-type,source-type] -->
2.9
2.10 <xsl:template match="*[@template:multiple-choice-field]">
2.11 <xsl:variable name="field-element" select="substring-before(@template:multiple-choice-field, ',')"/>
2.12 <xsl:variable name="field-attr-info" select="substring-after(@template:multiple-choice-field, ',')"/>
2.13 <xsl:variable name="field-attr" select="substring-before($field-attr-info, ',')"/>
2.14 - <xsl:variable name="field-attr-type" select="substring-after($field-attr-info, ',')"/>
2.15 + <xsl:variable name="field-attr-type-info" select="substring-after($field-attr-info, ',')"/>
2.16 + <xsl:variable name="field-attr-type" select="substring-before($field-attr-type-info, ',')"/>
2.17 + <xsl:variable name="field-source-type" select="substring-after($field-attr-type-info, ',')"/>
2.18 <xsl:copy>
2.19 <!-- Remove multiple-choice-field and replace name. -->
2.20 <xsl:apply-templates select="@*[local-name() != 'multiple-choice-field' and local-name() != 'name']"/>
2.21 @@ -141,7 +143,7 @@
2.22 <xsl:attribute name="template:element"><xsl:value-of select="$field-element"/></xsl:attribute>
2.23 </xsl:if>
2.24 <xsl:choose>
2.25 - <xsl:when test="$field-attr-type = 'new'">
2.26 + <xsl:when test="$field-attr-type = 'new' or field-attr-type = '' and $field-attr-type-info = 'new'">
2.27 <xsl:attribute name="name">{template:new-attribute('<xsl:value-of select="$field-attr"/>')}</xsl:attribute>
2.28 </xsl:when>
2.29 <xsl:when test="$field-attr = ''">
2.30 @@ -158,21 +160,31 @@
2.31 </xsl:template>
2.32
2.33 <!-- Multiple choice list fields, represented by menus and listboxes with multiple values. -->
2.34 - <!-- Format: element,list-element,list-attribute -->
2.35 + <!-- Format: element,list-element,list-attribute[,source-type] -->
2.36
2.37 <xsl:template match="*[@template:multiple-choice-list-field]">
2.38 <xsl:variable name="field-element" select="substring-before(@template:multiple-choice-list-field, ',')"/>
2.39 <xsl:variable name="field-list-info" select="substring-after(@template:multiple-choice-list-field, ',')"/>
2.40 <xsl:variable name="field-list-element" select="substring-before($field-list-info, ',')"/>
2.41 - <xsl:variable name="field-list-attr" select="substring-after($field-list-info, ',')"/>
2.42 + <xsl:variable name="field-list-attr-info" select="substring-after($field-list-info, ',')"/>
2.43 + <xsl:variable name="field-list-attr" select="substring-before($field-list-attr-info, ',')"/>
2.44 + <xsl:variable name="field-source-type" select="substring-after($field-list-attr-info, ',')"/>
2.45 <xsl:copy>
2.46 <!-- Remove multiple-choice-list-field and replace name. -->
2.47 <xsl:apply-templates select="@*[local-name() != 'multiple-choice-list-field' and local-name() != 'name']"/>
2.48 <xsl:if test="$field-element != '-'">
2.49 <xsl:attribute name="template:element"><xsl:value-of select="$field-element"/></xsl:attribute>
2.50 </xsl:if>
2.51 - <xsl:attribute name="name">{template:list-attribute('<xsl:value-of select="$field-list-element"/>',
2.52 - '<xsl:value-of select="$field-list-attr"/>')}</xsl:attribute>
2.53 + <xsl:choose>
2.54 + <xsl:when test="$field-list-attr != ''">
2.55 + <xsl:attribute name="name">{template:list-attribute('<xsl:value-of select="$field-list-element"/>',
2.56 + '<xsl:value-of select="$field-list-attr"/>')}</xsl:attribute>
2.57 + </xsl:when>
2.58 + <xsl:otherwise>
2.59 + <xsl:attribute name="name">{template:list-attribute('<xsl:value-of select="$field-list-element"/>',
2.60 + '<xsl:value-of select="$field-list-attr-info"/>')}</xsl:attribute>
2.61 + </xsl:otherwise>
2.62 + </xsl:choose>
2.63 <xsl:apply-templates select="*|node()"/>
2.64 </xsl:copy>
2.65 </xsl:template>
3.1 --- a/XSLForms/XSL/Schema.xsl Sat Jun 21 01:38:50 2008 +0200
3.2 +++ b/XSLForms/XSL/Schema.xsl Sun Dec 11 21:45:19 2005 +0000
3.3 @@ -155,11 +155,16 @@
3.4 <xsl:variable name="field-element" select="substring-before(@template:multiple-choice-field, ',')"/>
3.5 <xsl:variable name="field-attr-info" select="substring-after(@template:multiple-choice-field, ',')"/>
3.6 <xsl:variable name="field-attr" select="substring-before($field-attr-info, ',')"/>
3.7 - <xsl:variable name="field-attr-type" select="substring-after($field-attr-info, ',')"/>
3.8 + <xsl:variable name="field-attr-type-info" select="substring-after($field-attr-info, ',')"/>
3.9 + <xsl:variable name="field-attr-type" select="substring-before($field-attr-type-info, ',')"/>
3.10 + <xsl:variable name="field-source-type" select="substring-after($field-attr-type-info, ',')"/>
3.11 <xsl:choose>
3.12 <xsl:when test="$field-element != '-'">
3.13 <element type="multiple-choice">
3.14 <xsl:attribute name="name"><xsl:value-of select="$field-element"/></xsl:attribute>
3.15 + <xsl:if test="$field-source-type = 'dynamic'">
3.16 + <xsl:attribute name="source">dynamic</xsl:attribute>
3.17 + </xsl:if>
3.18 <attribute>
3.19 <xsl:choose>
3.20 <xsl:when test="$field-attr != ''">
3.21 @@ -175,6 +180,9 @@
3.22 </xsl:when>
3.23 <xsl:otherwise>
3.24 <xsl:attribute name="type">multiple-choice</xsl:attribute>
3.25 + <xsl:if test="$field-source-type = 'dynamic'">
3.26 + <xsl:attribute name="source">dynamic</xsl:attribute>
3.27 + </xsl:if>
3.28 <attribute>
3.29 <xsl:choose>
3.30 <xsl:when test="$field-attr != ''">
3.31 @@ -193,11 +201,16 @@
3.32 <xsl:variable name="field-element" select="substring-before(@template:multiple-choice-list-field, ',')"/>
3.33 <xsl:variable name="field-list-info" select="substring-after(@template:multiple-choice-list-field, ',')"/>
3.34 <xsl:variable name="field-list-element" select="substring-before($field-list-info, ',')"/>
3.35 - <xsl:variable name="field-list-attr" select="substring-after($field-list-info, ',')"/>
3.36 + <xsl:variable name="field-list-attr-info" select="substring-after($field-list-info, ',')"/>
3.37 + <xsl:variable name="field-list-attr" select="substring-before($field-list-attr-info, ',')"/>
3.38 + <xsl:variable name="field-source-type" select="substring-after($field-list-attr-info, ',')"/>
3.39 <xsl:choose>
3.40 <xsl:when test="$field-element != '-'">
3.41 <element type="multiple-choice-list">
3.42 <xsl:attribute name="name"><xsl:value-of select="$field-element"/></xsl:attribute>
3.43 + <xsl:if test="$field-source-type = 'dynamic'">
3.44 + <xsl:attribute name="source">dynamic</xsl:attribute>
3.45 + </xsl:if>
3.46 <attribute>
3.47 <xsl:attribute name="name"><xsl:value-of select="$field-list-attr"/></xsl:attribute>
3.48 </attribute>
3.49 @@ -206,6 +219,9 @@
3.50 </xsl:when>
3.51 <xsl:otherwise>
3.52 <xsl:attribute name="type">multiple-choice-list</xsl:attribute>
3.53 + <xsl:if test="$field-source-type = 'dynamic'">
3.54 + <xsl:attribute name="source">dynamic</xsl:attribute>
3.55 + </xsl:if>
3.56 <attribute>
3.57 <xsl:attribute name="name"><xsl:value-of select="$field-list-attr"/></xsl:attribute>
3.58 </attribute>
3.59 @@ -244,10 +260,19 @@
3.60 <xsl:variable name="field-element" select="substring-before(@template:multiple-choice-value, ',')"/>
3.61 <xsl:variable name="field-attr-info" select="substring-after(@template:multiple-choice-value, ',')"/>
3.62 <xsl:variable name="field-attr" select="substring-before($field-attr-info, ',')"/>
3.63 - <xsl:variable name="field-set-attr" select="substring-after($field-attr-info, ',')"/>
3.64 + <xsl:variable name="field-set-attr-info" select="substring-after($field-attr-info, ',')"/>
3.65 + <xsl:variable name="field-set-attr" select="substring-before($field-set-attr-info, ',')"/>
3.66 + <xsl:variable name="field-contents" select="substring-after($field-set-attr-info, ',')"/>
3.67 <xsl:attribute name="name"><xsl:value-of select="$field-element"/></xsl:attribute>
3.68 <xsl:attribute name="expr">@<xsl:value-of select="$field-attr"/> = ../@<xsl:value-of select="$field-attr"/></xsl:attribute>
3.69 - <xsl:attribute name="expr-attr"><xsl:value-of select="$field-set-attr"/></xsl:attribute>
3.70 + <xsl:choose>
3.71 + <xsl:when test="$field-set-attr != ''">
3.72 + <xsl:attribute name="expr-attr"><xsl:value-of select="$field-set-attr"/></xsl:attribute>
3.73 + </xsl:when>
3.74 + <xsl:otherwise>
3.75 + <xsl:attribute name="expr-attr"><xsl:value-of select="$field-set-attr-info"/></xsl:attribute>
3.76 + </xsl:otherwise>
3.77 + </xsl:choose>
3.78 <attribute>
3.79 <xsl:attribute name="name"><xsl:value-of select="$field-attr"/></xsl:attribute>
3.80 </attribute>
3.81 @@ -258,12 +283,21 @@
3.82 <xsl:variable name="field-element" select="substring-before(@template:multiple-choice-list-value, ',')"/>
3.83 <xsl:variable name="field-attr-info" select="substring-after(@template:multiple-choice-list-value, ',')"/>
3.84 <xsl:variable name="field-attr" select="substring-before($field-attr-info, ',')"/>
3.85 - <xsl:variable name="field-set-attr" select="substring-after($field-attr-info, ',')"/>
3.86 + <xsl:variable name="field-set-attr-info" select="substring-after($field-attr-info, ',')"/>
3.87 + <xsl:variable name="field-set-attr" select="substring-before($field-set-attr-info, ',')"/>
3.88 + <xsl:variable name="field-contents" select="substring-after($field-set-attr-info, ',')"/>
3.89 <xsl:attribute name="name"><xsl:value-of select="$field-element"/></xsl:attribute>
3.90 <xsl:attribute name="expr">@value-is-set</xsl:attribute>
3.91 <!-- Special attribute corresponding with the expression. -->
3.92 <xsl:attribute name="expr-name">value-is-set</xsl:attribute>
3.93 - <xsl:attribute name="expr-attr"><xsl:value-of select="$field-set-attr"/></xsl:attribute>
3.94 + <xsl:choose>
3.95 + <xsl:when test="$field-set-attr != ''">
3.96 + <xsl:attribute name="expr-attr"><xsl:value-of select="$field-set-attr"/></xsl:attribute>
3.97 + </xsl:when>
3.98 + <xsl:otherwise>
3.99 + <xsl:attribute name="expr-attr"><xsl:value-of select="$field-set-attr-info"/></xsl:attribute>
3.100 + </xsl:otherwise>
3.101 + </xsl:choose>
3.102 <attribute>
3.103 <xsl:attribute name="name"><xsl:value-of select="$field-attr"/></xsl:attribute>
3.104 </attribute>