Section 2.7 Example Revisions

I'll take a shot at revising the model example in section 2.7.
 
<xforms:model>
  <xforms:instance>
    <payment as="credit" xmlns="http://commerce.example.com/payment">
      <cc/>
      <exp/>
    </payment>
  </xforms:instance>
  <xforms:schema xlink:href="payschema.xsd"/>
  <xforms:submitInfo action="http://example.com/submit" method="post"/>
  <xforms:bind ref="my:payment/my:cc"
      relevant="../my:payment/@as = 'credit'"
      required="true()" type="my:cc"/>
  <xforms:bind ref="my:payment/my:exp"
      relevant="/my:payment/@as = 'credit'"
      required="true()" type="xsd:gYearMonth"/>
</xforms:model>

The most important change is the relevant contraint. The XPath expression is
evaluated relative to each node in the node-set selected by the ref
attribute (i.e. context node is ref[n]). So, backing up to the ancestor in
bind 1 or providing a absolute path is necessary. 
 
Hope this helps,
 
- Ryan
 
  _____  

Ryan Tomayko < rtomayko@stercomm.com <mailto:rtomayko@stercomm.com> >
Sterling Commerce
x5183

  _____  

 

Received on Wednesday, 12 December 2001 10:59:28 UTC