state of XSLT2/XPath2 or XQuery in CPython

C

Christof Hoeke

hi,
I was wondering if there is any way to use XSLT2 or maybe even XQuery
with "normal" CPython. Using Saxon/XSLT2 with Jython is no problem (I
have not tried Saxon.NET with IronPython but suspect no problem?) but I
could not find any way to use XSLT2 or XPath Features with CPython. All
the usual suspects 4suite or libxslt (via lxml) seem to have no support
yet. Is there any hope I oversaw something?

Would be especially interesting for a WSGI application, so a more or
less complicated hack via CPython->Jython->Saxon and back would probably
not be very useful (if that is possible at all).

thanks!
Chris
 
S

Stefan Behnel

Christof said:
I was wondering if there is any way to use XSLT2 or maybe even XQuery
with "normal" CPython. Using Saxon/XSLT2 with Jython is no problem (I
have not tried Saxon.NET with IronPython but suspect no problem?) but I
could not find any way to use XSLT2 or XPath Features with CPython. All
the usual suspects 4suite or libxslt (via lxml) seem to have no support
yet. Is there any hope I oversaw something?

I wouldn't know any implementation. Are you looking for a specific feature?
Using Python functions in XPath/XSLT might get you pretty close to XPath2.

Stefan
 
C

Christof Hoeke

Stefan said:
I wouldn't know any implementation. Are you looking for a specific feature?
Using Python functions in XPath/XSLT might get you pretty close to XPath2.

Almost full XSLT2 Support (minus XML Schema support, IMHO not too useful
part of XSLT2) would be the best as writing templates in a general
templating lang as XSLT is great if you use the same ones in cross-lang
systems which are e.g. usable in Java or Python environment.

Especially XPath Support with temporary trees (and not just fragments)
is very useful (I know EXSLT is an option, but still not quite as good
as XSLT2). Or stuff like sequences in XPAth2 simplifies development
quite a bit (I think the following is possible, have not used it in the
last weeks though):
(a, b, c)[@att='123']

Or using sequences for ordering stuff like e.g.:

in XSLT1:
<xsl:apply-templates select="a"/>
<xsl:apply-templates select="b"/>

which in XSLT2 simply is:
<xsl:apply-templates select="a, b"/>

I used the Python extension functions some years ago in Pyana and later
in LXML which is great but these naturally very much depend on Python
then...

I know XML and therefor also XSLT seem not the most favourite of tools
in the Python community but for e.g. document based systems like CMS
systems XML and XSLT is at least in my experience a great combination.

thanks
Christof
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top