Re: [xsl] xpath analyser in XSL-T 1 or 2

Subject: Re: [xsl] xpath analyser in XSL-T 1 or 2
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 2 Apr 2007 15:35:46 +0100
> This sounds like a promising approach. When I first saw the address I
> thought it would have something to do with monetDB xquery,

MONET was a EU funded research project for Mathematics ON the WEB, the
project's gone but the web server is still there and NAG was kind enough
to let me use it.

> Do an Xquery with Xpath X, pass Xpath X  to the Xq2xml get back xml,

Yes, that part isn't really me/xq2xml it's a built in feature (which was
added at my request) of the xquery/xpath parsers provided by the working
groups (Scott Boag, mainly)
http://www.w3.org/2005/qt-applets/xqueryApplet.html

from there on. you may not want any of the xq2xml code at all, but just
use MY stylesheets as an example, for example

http://monet.nag.co.uk/xq2xml//index.html#s6

is a stylesheet that removes any references to optional (in xquery) axes
such as preceding::, replacing


$y/preceding::*[2]/string(@i)

by
  $y/
(let $here := . return
   reverse(root()/descendant::*[. << $here][not(descendant::node()[. is $here])]))
[2]/string(@i)

which is essentially just a single template

<xsl:template match="StepExpr[ReverseAxis/data='preceding']">

(let $here := . return
   reverse(root()/descendant::
<xsl:apply-templates select="NodeTest"/>
[. << $here][not(descendant::node()[. is $here])]))
<xsl:apply-templates select="* except (ReverseAxis|NodeTest)"/>
</xsl:template>


David

Current Thread