OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   RE: [xml-dev] Streaming Transformations for XML

[ Lists Home | Date Index | Thread Index ]

> From: Paul Prescod [mailto:paul@prescod.net]


> I did something like this once but I don't quit understand how you
> expect the rule to know when all of the variables are "fully 
> collected".
> In my model you had actions on the start event and end event. If you
> didn't have enough data by the end event then you were kind of out of
> luck. I'm curious about your model.

The model I was thinking of was similar. If the variables use XPath
expressions that only select along the child, descendant, or attribute axes,
then you can be assured that they are "fully collected" when the end event
for the node matching the template pattern is received.

For instance, something like:

 <template match="PersonInfo">
    <variable name="firstName" select="firstName"/>
    <variable name="id" select="@objectId"/>
    <variable name="zipCode" select="homeAddress/zipCode"/>

This is a silly example, but I think it illustrates what I'm thinking
(though I have not pursued this line of thought in great depth). When you
get the end event for a "PersonInfo" element, you know that the variables
have collected all of the data relevant to this particular element. This
only works, of course, if you restrict the axes that can be used for
selecting the variables values (or at least have analyzed the expression and
know what axes are used). If you know what axes are used in the XPath
expressions, then it seems like it shouldn't be necessary to explicitly
define whether you want something to happen in the start event or end event.
For instance, if the variables only select along the attribute axis, then
you could fire off the action in the start event and you don't need to wait
for the end event. 

Two other key constraints, here. There are restrictions as to what axes can
be referenced in the "match" expression for the template. The idea is that a
stack is maintained keeping track of the ancestor nodes of each element for
matching purposes, but children are not automatically remembered (and
template matching is done in the start event for the element); so you can't
do something like include a predicate that selects along the child axis
(since it hasn't parsed that, yet, when an element is matched). You could
include a predicate, though, that filters based on attribute values. Also,
any action that gets fired only has access to data that has been collected
into a variable. There is no tree of nodes to traverse. 

As I mention above, I haven't pursued this line of thought in great depth.
This is just something I've been thinking about relatively recently, and
I've toyed with the idea of trying to use SAXPath[1] to implement something
like this. But I haven't seriously pursued it, at this point.

[1] http://www.saxpath.org

  • Follow-Ups:


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS