W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2003

Evaluation using a "nodeset"

From: David Landwehr <DLandwehr@novell.com>
Date: Wed, 12 Feb 2003 16:25:47 +0100
Message-Id: <se4a7599.000@cpl-emea-mail1.cpl.novell.com>
To: <www-dom@w3.org>

Greetings,

The Level 3 XPath Specification assumes a simple evaluation context
with a
single context node having context position 1 and context size 1.
However in
some cases like XForms and XSLT the evaluation context is specified to
be
something more, in particular a context with a context node that has a
context
position and a context size of something different from 1. I'll give an
example
using XForms:

<xforms:model>
    <xforms:instance>
        <data xmlns=""><a/><a/><a/></data>
    </xforms:instance>
    <xforms:bind nodeset="/data/a" calculate="position()"/>
</xforms:model>

The 'bind' will select all a's (the selected nodeset) from the
instance
document, for each a the 'calculate' expression will be evaluated using
the
context position in the selected nodeset and the size of the selected
nodeset as
the context size. This will produce the following instance:

<data xmlns=""><a>1</a><a>2</a><a>3</a></data>

It would be nice if this kind of expression could be evaluated using
the DOM
Level 3 XPath Specification, e.g. the XPathExpression could have an
overloaded
method:

XPathResult evaluate(in Node contextNode,
                     in unsigned long position,
                     in unsigned long size,
                     in unsigned short type, 
                     in XPathResult result)
                     raises(XPathException,  DOMException);

Best regards,
David Landwehr
Received on Wednesday, 12 February 2003 10:26:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:56 GMT