[xsl] RE: how to sort a list of xpaths

Subject: [xsl] RE: how to sort a list of xpaths
From: "Philip Fearon" <pgfearo@xxxxxxxxxxxxxx>
Date: Tue, 22 Jan 2008 09:02:10 +0000
Mark H Wrote:
>...Here's my question (finally!) - do anyone have a utility or xslt, perl
>etc that can sort these [XPath] rules based on a schema?

There is a utility app I wrote called SketchPath that is an XPath
library manager that may help.

This provides a GUI for building, testing and managing your XPath
expressions. Whilst the utility doesn't sort XPath expressions in the
way that you seek, it saves the XPath expressions in XML in a form
that may be sorted, extract below:


<Expression diffgr:id="Expression5"  msdata:rowOrder="0"
diffgr:hasChanges="inserted" >
<isvariable>true</isvariable>
<name>Member-5</name>
<group>Group1a</group>
<fullexpression>/Tournament/Teams/Team[2]/Member</fullexpression>
<recentvalue>p2</recentvalue>
<context>/</context>
<comment>Tournament.xml</comment>
<textStart>372</textStart>
<textLength>17</textLength>
</Expression>

<Expression diffgr:id="Expression6" ...

The <textStart> and <textLength> elements contain the start position
and length of the first node in the xml nodeset returned by the
expression. These values are stored when the expression is evaluated
against the xml instance that the XPath expressions were developed
with.

Some additional XSLT would then allow you to turn this XML into a
sorted list of XPath expressions. The assumption is that its possible
to create an XML instance that can represent the document node order
in all permitted cases.

Phil Fearon
http://www.sketchpath.com

Current Thread