W3C home > Mailing lists > Public > public-xml-processing-model-comments@w3.org > February 2008

Re: A few items cherry-picked from comment #54 - proposal for p:label-elements

From: Alex Milowski <alex@milowski.org>
Date: Wed, 6 Feb 2008 11:47:01 -0800
Message-ID: <28d56ece0802061147j3de90a4flc1412407f10d5f07@mail.gmail.com>
To: public-xml-processing-model-comments@w3.org

On 1/25/08, Norman Walsh <ndw@nwalsh.com> wrote:
> We defered an issue (#54) at the f2f but then failed to return to it.
>
> 3. Should we add a scheme to p:label-elements that generates an ID by
>    evaluating an XPath expression?
>

Here is a proposal based on our discussion on the call:

   * drop the 'prefix', 'suffix', and 'scheme' options.
   * add a new option called 'label' which is an XPath expression
   * If the 'label' option is not present, the expression
"concat('_',$p:index)" is used.

The text would be:


The value of the attribute option must be a QName.

The value of the match option must be an XSLTMatchPattern. It is a
dynamic error (err:XC0024) if that expression matches anything other
than element nodes.

This step operates by generating attribute labels for each element
matched.  For every matched element, the expression is evaluated with
the context node set to the matched element.  An attribute is added to
the matched element using the attribute
name is specified the attribute option and the string value of result
of evaluating the
expression.  If the attribute already exists on the matched element,
the value is
replaced with the string value of the expression evaluation result.

An implementation must bind the variable 'p:index'  in the static
context of each evaluation to the position of the element in the
sequence  of matched elements.  In
other words, the first element (in document order) matched gets the
label "1", the
second gets the label "2", the third, "3", etc.

The result of the p:label-elements step is the input document with the
attribute
labels associated with matched elements.  All other non-matching content
remains the same.


We may optionally add a note that says something like:

An implementation may detect that the XPath expression does not require the
context node or apply other such optimizations that do not require
caching of the
whole document.


I had to remove the statement about unique values because an expression
like "'string'" would evaluation to the same value for every element.

Also, we should decide whether p:index is a string or number.

-- 
--Alex Milowski
"The excellence of grammar as a guide is proportional to the paucity of the
inflexions, i.e. to the degree of analysis effected by the language
considered."

Bertrand Russell in a footnote of Principles of Mathematics
Received on Wednesday, 6 February 2008 19:47:31 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 6 February 2008 19:47:32 GMT