[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Walking a complex object graph
Hi William, > Specifically, assume that one has a set of in-memory objects X, Y, > Z... etc, with properties such as "name", "ID", etc. These objects > have references to each other, and these references might be single > objects or they might be lists. So for example X.ref1 might be Y, > and Y.ref2 might be the list ( X, Y, Z ). > > Note in particular that there may be circularities in the > references, so this is best viewed as an arbitrarily-connected graph > of objects. There have been a couple of other attempts at this kind of thing that you might want to check out: 1. Norm Walsh's RDF Twig creates 'twigs' (small trees) based on a (RDF) graph and enables you to access them via extension functions in Saxon and Xalan. See http://rdftwig.sourceforge.net/ 2. Henry Thompson's work on accessing the PSVI via XPath, which ignores re-entrancy and circularity. See http://www.idealliance.org/papers/extreme03/html/2003/Thompson01/EML2003Thompson01.html I did something similar to use XPath syntax to navigate over LMNL (http://www.lmnl.net) models (which aren't graphs, but in which a 'node' can have more than one 'parent', and 'attributes' can have 'attributes' themselves, as well as 'children'). I used Jaxen (http://jaxen.sourceforge.net/), which enables you to plug in your own data model to their XPath engine. But that doesn't give you full XSLT, just XPath. > Or is this simply an incorrect application of XSLT? > For example do XSLT implementations generally assume the source > document is finite, and can be completely read into memory > before the transformation begins? Yes, XSLT engines are constructed to operate over XPath data model instances, which are defined as (finite) trees. You might well run into problems with the "smarter" XSLT engines that optimise based on this assumption. You could instead try an approach where you create a tree in which every object is represented at the top level, and you navigate between them using the id() function. This is easier in XPath 2.0 where function calls can be part of the path. You might want to create your own functions that have more meaningful names to help you keep track of where you are within the graph. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|