Subject: Re: [xsl] Walking a complex object graph From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Sat, 17 Jul 2004 09:58:16 +0100 |
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/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Walking a complex object , Michael Kay | Thread | [xsl] Okay to build Keys on Variabl, Karl J. Stubsjoen |
[xsl] Re: Retaining value of a Glob, Angeshwar Deepak | Date | Re: [xsl] Retaining value of a Glob, M. David Peterson |
Month |