W3C home > Mailing lists > Public > www-forms@w3.org > December 2006

XPath based context and filtering for submission?

From: Klotz, Leigh <Leigh.Klotz@xerox.com>
Date: Thu, 30 Nov 2006 16:00:12 -0800
Message-ID: <E254B0A7E0268949ABFE5EA97B7D0CF402856F81@usa7061ms01.na.xerox.net>
To: "www-forms" <www-forms@w3.org>

Itwouldbeniceif there were a way to filter a list of matching nodes to

I would like to submit only the index numbers of items whose @selected
attribute is true.

The present definition of submission/@ref uses the first nodeset rule,
so you cannot just do
Additionally, the ref attribute doesn't appear to be precise enough to
specify what parts of the tree to submit and what parts to leave out.

Some simple XPath-based filtering syntax like that would be attractive,

Here's one way to do it, using a control variable (set during submission
only) and a pair of bind elements, one to say the
"/lines/line[boolean-from-string(@selected)]" part and another to say
that "index" part. 

Can anybody think of a clever union expression to put in submission/@ref
that just does what I want?

<instance id="data">
  <data xmlns="">
      <line selected="false">
      <line selected="false">
      <line selected="false">

<instance id="results">
  <empty xmlns=""/>

<instance id="control">
  <control xmlns="">

<bind nodeset="instance('data')lines/line/@selected" type="xsd:boolean"
<bind nodeset="instance('control')/selected" type="xsd:boolean" />

<bind nodeset="instance('data')/lines/*[local-name(.)!='index']" 
<bind nodeset="instance('data')/lines/line"
or boolean-from-string(@selected)"/>

<submission id="delete" action="/delete" ref="instance('data')"
replace="instance" instance="results">
   <setvalue ev:event="xforms-submit"
   <setvalue ev:event="xforms-submit-done"
   <setvalue ev:event="xforms-submit-error"

<submit submission="delete">

<repeat id="lines" nodeset="lines/line">
  <input ref="@selected">
    <label class="columnHeader">X</label>
  <output ref="date">
    <label class="columnHeader">Date</label>
  <output ref="name">
    <label class="columnHeader">Name</label>

<output ref="lines/line[index('lines')]/text">
Received on Friday, 1 December 2006 00:00:30 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:19 UTC