[xsl] XSLT functions in XPath

Subject: [xsl] XSLT functions in XPath
From: Victor Toni <xsl-list@xxxxxxxxx>
Date: Mon, 09 Oct 2006 19:57:09 +0200
Hello All,

I am working on an XSLT-like project, which uses XPath expression to
retrieve data from an XML source and writes the results into a resulting
data structure.

XPath evaluation may be dependent on the results of previous
evaluations, for example

contextA = //author[@name = 'someName']
contextB = //book[@isbn] using contextA

I am using the Saxon XPath implementation over DOM to take advantage of
the XPAth 2.0.
This works really well most of the time (the time when I am not missing
anything), however I would like to have access to two more functions
which would be really helpful:

current()
sort()

Is it somehow possible to use current() in "normal" XPath, an example:

contextA = //@isbn = '1234567'
contextB = //author[books/book/@isbn = current() ] using contextA

(I know that I could use a VariableResolver but this would be a bit over
the top of what I would like to do and I would have to change the syntax
of my currently really trivial configuration files ;-) )

In XSLT one can sort a nodeset by providing additional XPath expression.
Prior to Saxon I used Jaxen and wrote me an extension function which
could basically do something like

sort-by(//author, '@name', '@forename')
or
sort-by(//book, 'number(@year)')

Since Saxon has many more extension functions I wondered if I could use
the its XSLT functionality somehow for this task.

Any hints are much appreciated.

Kindest regards,
Victor

Current Thread