xsl-list
[Top] [All Lists]

[xsl] XSLT functions in XPath

2006-10-09 10:57:28
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[(_at_)name = 'someName']
contextB = //book[(_at_)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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--