Re: [xsl] Ranking Random Nodes from Top to Bottom

Subject: Re: [xsl] Ranking Random Nodes from Top to Bottom
From: Abel Braaksma <>
Date: Fri, 17 Aug 2007 15:30:47 +0200
J. Zhang wrote:

I was thinking of the determining the string length from root to a particular node, and store that as output in the output file using XSLT. Then post-process it in Python to rank the paths into document order, where the lowest number appears on top and the highest number at the bottom. Does that make any sense?

an example would help a great deal here. You've talked of unstructured text in your first post, now I understand that it is actually about real nodes. It seems to me that you have strings of XPaths and that for some reason (why?) you want to show them to the user in the order equal to what the XPaths would select from the (a?) document. If so, what about an XPath that selects multiple nodes?

To know whether one node is before the other, you can use the preceding:: axis (but this is an expensive operation). But you'll first have to write an XPath parser in XSLT if you want the xpaths to be given as strings. If you can (or want to) rely on extensions, you can use saxon:evaluate() when you run your stylesheets with Saxon.

Cheers, -- Abel Braaksma

Current Thread