From: Andrew Welch <ajwelch@pi...> - 2004-09-03 08:35:59
> I am trying to process a 14MB xml file into many html pages.=20
> I am using=20
> Saxon 6.5.3.
> I am using code based on Mike's ShowBooks example to only=20
> read the xml=20
> once, set a target node as a parameter to each transform and then=20
> process the whole tree for each page.
> I need to process the whole tree each time because I am building=20
> navigation links for each page that depend on the whole site-map.
> As soon as I start using the ancestor-or-self axis in my XPath=20
> expressions the speed of page generation drops way off. The=20
> hierarchy is=20
> more wide than deep (not more than 6 levels) so looking up an=20
> hierarchy shouldn't be that much of a hit.
> Has anyone else encountered a similar problem and come up with an=20
> acceptable solution? i.e. is is possible to build a key for=20
> all ancestor=20
You can use a key to access ancestor nodes from a given node, but you
haven't really given enough information to suggest a key for what you
When you walk the ancestor node your processing time will increase
proportionally to the number of ancestors in your hierarchy, so its
understandable that the transformation slows down. One solution to this
is to do the transformation in two-passes (usually in one stylesheet)
where the first pass does the processing you were previously doing by
walking the ancestor axis, and the second pass queries this tree for the
information. This technique should give you a constant performance
complexity, but does need more memory for the temporary trees. Again,
without seeing any source/requirements I can't say whether this is
useful to you or not.
Get latest updates about Open Source Projects, Conferences and News.