W3C home > Mailing lists > Public > public-xml-processing-model-wg@w3.org > June 2007

Re: The semantics of position() -- trying to be very explicit

From: Norman Walsh <ndw@nwalsh.com>
Date: Thu, 07 Jun 2007 08:11:02 -0400
To: public-xml-processing-model-wg@w3.org
Message-ID: <87fy54hsmh.fsf@nwalsh.com>
/ Innovimax SARL <innovimax@gmail.com> was heard to say:
| if we state that p:position() is bounded to the position of the input sequence
| then
| "div[p:position()=2]" would select the divs of the second document in
| the sequence in a for-each

Just to be sure I understand: his would be in a match on a viewport
inside a for-each and it would match all the div elements that were
the second children of their parents in the second document in the
for-each sequence and no divs in any other document, right?

If you wanted that, and if you we use the context position instead of
a p:position() function, you can still get the behavior you need:

    <p:option name="iteration" select="position()"/>
    <p:viewport match="div[$iteration = 2]">

Yes, you have to work a little harder for this case, but I think this
qualifies as making hard things possible :-)

In fact, if we had a p:position() function, I don't think this:

  <p:viewport match="div[p:position() = 2]">

would work anyway. Inside the viewport p:position() would return "0"
until a div had been matched. Since div[0=2] will never match
anything, you'd ... never match anything.

                                        Be seeing you,

Norman Walsh <ndw@nwalsh.com> | I'm NOT in denial!
http://nwalsh.com/            | 

Received on Thursday, 7 June 2007 12:11:14 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:32:43 UTC