Skip to content

Commit

Permalink
Adjust fr:dropdown-date/fr:field-date for XPath type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
ebruchez committed Dec 11, 2012
1 parent eb1712e commit b89e11b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Expand Up @@ -112,18 +112,18 @@
<xf:var name="value" as="xs:string" value="$binding/string()">
<xf:action ev:event="xforms-value-changed xforms-enabled">
<!-- Only set local values if the bound node is an xs:date -->
<xf:action if="$binding castable as xs:date">
<xf:action if="$value castable as xs:date">
<xf:setvalue ref="instance('date-instance')/year" value="year-from-date($binding)"/>
<xf:setvalue ref="instance('date-instance')/month" value="month-from-date($binding)"/>
<xf:setvalue ref="instance('date-instance')/day" value="day-from-date($binding)"/>
</xf:action>
<xf:action if="not($binding castable as xs:date) and normalize-space($binding) = ''">
<xf:action if="not($value castable as xs:date) and normalize-space($value) = ''">
<xf:setvalue ref="instance('date-instance')/year"/>
<xf:setvalue ref="instance('date-instance')/month"/>
<xf:setvalue ref="instance('date-instance')/day"/>
</xf:action>
<xf:action if="not($binding castable as xs:date) and count(tokenize($binding, '-')) ge 3">
<xf:action iterate="tokenize($binding, '-')">
<xf:action if="not($value castable as xs:date) and count(tokenize($value, '-')) ge 3">
<xf:action iterate="tokenize($value, '-')">
<xf:var name="position" value="position()" as="xs:integer"/>
<xf:setvalue ref="instance('date-instance')/*[$position]"
value="if (context() castable as xs:integer) then xs:integer(context()) else ''"/>
Expand Down
8 changes: 4 additions & 4 deletions src/resources-packaged/xbl/orbeon/fields-date/fields-date.xbl
Expand Up @@ -85,18 +85,18 @@
<xf:var name="value" as="xs:string" value="$binding/string()">
<xf:action ev:event="xforms-value-changed xforms-enabled">
<!-- Only set local values if the bound node is an xs:date -->
<xf:action if="$binding castable as xs:date">
<xf:action if="$value castable as xs:date">
<xf:setvalue ref="instance('date-instance')/year" value="year-from-date($binding)"/>
<xf:setvalue ref="instance('date-instance')/month" value="month-from-date($binding)"/>
<xf:setvalue ref="instance('date-instance')/day" value="day-from-date($binding)"/>
</xf:action>
<xf:action if="not($binding castable as xs:date) and normalize-space($binding) = ''">
<xf:action if="not($value castable as xs:date) and normalize-space($value) = ''">
<xf:setvalue ref="instance('date-instance')/year"/>
<xf:setvalue ref="instance('date-instance')/month"/>
<xf:setvalue ref="instance('date-instance')/day"/>
</xf:action>
<xf:action if="not($binding castable as xs:date) and count(tokenize($binding, '-')) ge 3">
<xf:action iterate="tokenize($binding, '-')">
<xf:action if="not($value castable as xs:date) and count(tokenize($value, '-')) ge 3">
<xf:action iterate="tokenize($value, '-')">
<xf:var name="position" value="position()" as="xs:integer"/>
<xf:setvalue ref="instance('date-instance')/*[$position]"
value="if (context() castable as xs:integer) then xs:integer(context()) else ''"/>
Expand Down

0 comments on commit b89e11b

Please sign in to comment.