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

Re: Viewport and nested selected nodes

From: Innovimax SARL <innovimax@gmail.com>
Date: Sun, 22 Oct 2006 08:22:58 +0200
Message-ID: <546c6c1c0610212322t6f0db7bfq3008c99ddc8bd95b@mail.gmail.com>
To: "Jeni Tennison" <jeni@jenitennison.com>
Cc: public-xml-processing-model-wg@w3.org

Dear,

Well, FWIW, I think it's a dynamic error if the select can select a
subtree in another subtree.
The author has to be more precise
Because, for me the default case, is not so obvious
Given the sample

<div>
 <p>
   <div>
     <math>
        <div/>
    </math>
  </div>
 </p>
 <div>
   <p>
     <div/>
   </p>
 </div>
</div>


I can think of a equal number of cases, where I want to select the
subtrees which do not contain any other subtrees (/div/p/div/math/div
and/div/div/p/div), or to select the subtree which contain the maximum
(/div) or something in between

those case could be written
//div[not(descendant::div)] or //div[not(ancestor::div)]

but in more subtle case (//div[math[@x][@y]]), the xpath expression
could become very difficult to write (and therefore to read)

Regarding this, i'm in favour of a default case, where it is a dynamic error

Then it could be enhanced in V1 or next by defining that
this default case could be materialized by an attribute @behavior
which default value is 'dynamic-error', and could be positionned to
'rootest' (most close to the root) or 'leafest' (more close to the
leaf), with the idea to help keeping the xpath simple.

'rootest' being the most important case for optimization (available as
soon as finded).
'dynamic-error' being used for debugging as default
'leafest' being the most resource consuming (imagine you match the
root, you have to process the whole document, before being sure you
catch the leafest node).

It could furthermore be a case, where we *need* recursion

== rootest case ==
<p:pipeline name="descendant-parser">
  <p:input name='document'/>
  .
  .
  <p:viewport name='bloc-selector' behavior='rootest'>
    <p:input port='bloc' step='step' source='port'
select='//bloc[...very complex predicate...]'/>
    <p:choose>
      <p:when test='...bloc contains other bloc with very complex predicate...'>
        <p:step name='descendant-parser'><!-- recursion -->
          <p:input name='document' step='bloc-selector' source='bloc'/>
          :
        </p:step>
      </p:when>
      <p:otherwise>
        <!-- i process the subtree with the context -->
        :
      </p:otherwise>
    </p:choose>
  </p:viewport>
</p:pipeline>


== leafest case ==
<p:pipeline name="trans-up-parser">
  <p:input name='document'/>
  .
  .
  <p:viewport name='bloc-selector' behavior='leafest'>
    <p:input port='bloc' step='step' source='port'
select='//bloc[...very complex predicate...]'/>
    :
    <!-- process all the leaf first -->
  </p:viewport>
  <p:choose>
    <p:when test='...document out from viewport still contains bloc
with very complex predicate...'>
      <p:step name='trans-up-parser'>
        <p:input name='document' .... />
        :
      </p:step>
    </p:when>
    <p:otherwise>
      <!-- all the bloc with very complex predicate have been processed -->
      :
    </p:otherwise>
  </p:choose>
</p:pipeline>


Regards,

Mohamed


On 10/21/06, Jeni Tennison <jeni@jenitennison.com> wrote:
>
> Hi,
>
> In the example of <p:viewport> in the spec:
>
> <p:viewport name="encdivs">
>    <p:declare-input port="div" step="step" source="port"
>                     select="//h:div[@class='enc']"/>
>    <p:declare-output port="html" step="encrypt" source="result"/>
>    <p:step name="encrypt" type="p:encrypt-document">
>      <p:input name="document" step="encdivs" source="div"/>
>    </:step>
> </p:viewport>
>
> what happens when one selected <div> is a descendant of another selected
> <div>?
>
> I think that viewport should probably filter the selected nodes to only
> those that do not have another selected node as a descendant.
>
> Cheers,
>
> Jeni
> --
> Jeni Tennison
> http://www.jenitennison.com
>
>


-- 
Innovimax SARL
Consulting, Training & XML Development
9, impasse des Orteaux
75020 Paris
Tel : +33 8 72 475787
Fax : +33 1 4356 1746
http://www.innovimax.fr
RCS Paris 488.018.631
SARL au capital de 10.000 
Received on Sunday, 22 October 2006 06:24:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:21:49 GMT