Re: 4 Rendering Custom Content

Cameron McCormack wrote:
>>It is one thing to have XPath evaluator and it is a different thing to
>>have XPath dependency tracker, right? How hard is such tracker, based
>>from your experience? I thought that it is fairly hard, but if it is
>>not maybe we need such thing. It would help in #8 as well.
> 
> It's not terribly difficult.  My algorithm involved stepping through the
> XPath ignoring any square bracket predicates.

Ignoring the predicates means you're missing a lot of dependencies, but 
then I'm not sure that's what you're doing since you mention handling 
them later on. If you do, do you handle position testing?

> So we start with the current node (in my case, the element whose
> attribute this XPath is describing).  Then recursively for each step:
> 
>   - if it's an id() function call, add a deep attribute dependency on
>     the document element for "id" attributes.  If we're not currently
>     inside a predicate, evaluate the id() function call and for each
>     node in the resulting nodeset, recurse.

How does this interact with DOM 3 Element::setIdAttribute and friends?

http://www.w3.org/TR/2004/PR-DOM-Level-3-Core-20040205/core.html#ID-ElSetIdAttr

> Currently I ignore the namespace, following and preceding axes.  In my
> CSVG project I have other dependencies that are set up when extension
> functions are called, e.g. for bounding boxes.

Does that not imply that for any added extension function one may also 
need to write special dependency handling code?

What happens to generate-id()? Since it's not guaranteed to produce the 
same result in two runs, does it work for a re-run if another part of 
the tree refers to it?

> It will be interesting to see if I can implement the XPath dependency
> analysis, constraint propagation and evaluation in plain SVG 1.1.
> Anyone know of an existing ECMAScript XPath evaluator or XPath to DOM
> calls compiler?

It's quite doable, apart from not having access to file and other such 
limitations (which are library limitations) there's nothing you can do 
in Java that you can't do in EcmaScript. There's an ActionScript XPath 
evaluator as part of DENG (now Open Sourced). Otherwise porting one 
wouldn't be hard. It'll be slow though.

-- 
Robin Berjon

Received on Wednesday, 10 March 2004 10:04:08 UTC