Re: [lxml] Antwort: XSLT 2

(cc-ing the list)
Von: "Henrik Genssen" <hg@mediafactory.de> so this effort has died and was not taken over? http://www.explain.com.au/libx/
Yes, to the best of my knowledge, meaning that I haven't seen activity there for years (2011?). Holger Landesbank Baden-Wuerttemberg Anstalt des oeffentlichen Rechts Hauptsitze: Stuttgart, Karlsruhe, Mannheim, Mainz HRA 12704 Amtsgericht Stuttgart

Holger Joukl, 25.04.2014 16:48:
Von: "Henrik Genssen" so this effort has died and was not taken over? http://www.explain.com.au/libx/
Yes, to the best of my knowledge, meaning that I haven't seen activity there for years (2011?).
Same here. I think the main problem is that XSLT2 has a rather different processing model than XSLT1 due to its schema awareness. Some V2 features can be implemented on top of XSLT1 without that, but most of it requires an XML Schema based data model. Without having looked into it too deeply, I would guess that this should need quite a bunch of changes in libxslt. The project above was meant to finance itself by making the code commercially available first, which clearly didn't pay off. Either because no-one really cares about XSLT2, or because those who do care rather use Java+Saxon. Saxon was written by the same person as the spec, so at least one person was interested in it at the time. Not sure if there are so many others who need it. Stefan

thanks for you explanation as well. Did anyone use http://www.exslt.org with lxml? They seem to have many functions limbxml ready, but I could not find any examples using them with lxml or a recommendation for using it instead of XSLT2. I am mostly interested in the date function - http://www.exslt.org/date/index.html - especially DateAdd: http://www.exslt.org/date/functions/add/index.html regards, Henrik p.s. is there any reason, why the list has no reply-to header set?
reply to message: date: 25.04.2014 17:44:14 from: "Stefan Behnel" <stefan_ml@behnel.de> to: lxml@lxml.de subject: Re: [lxml] Antwort: XSLT 2
Holger Joukl, 25.04.2014 16:48:
Von: "Henrik Genssen" so this effort has died and was not taken over? http://www.explain.com.au/libx/
Yes, to the best of my knowledge, meaning that I haven't seen activity there for years (2011?).
Same here. I think the main problem is that XSLT2 has a rather different processing model than XSLT1 due to its schema awareness. Some V2 features can be implemented on top of XSLT1 without that, but most of it requires an XML Schema based data model. Without having looked into it too deeply, I would guess that this should need quite a bunch of changes in libxslt.
The project above was meant to finance itself by making the code commercially available first, which clearly didn't pay off. Either because no-one really cares about XSLT2, or because those who do care rather use Java+Saxon. Saxon was written by the same person as the spec, so at least one person was interested in it at the time. Not sure if there are so many others who need it.
Stefan
_________________________________________________________________ Mailing list for the lxml Python XML toolkit - http://lxml.de/ lxml@lxml.de https://mailman-mail5.webfaction.com/listinfo/lxml

Von: "Henrik Genssen" thanks for you explanation as well.
Did anyone use http://www.exslt.org with lxml?
They seem to have many functions limbxml ready, but I could not find any examples using them with lxml or a recommendation for using it instead of XSLT2.
Yes, I've used some exslt stuff in the past, namely { http://exslt.org/dynamic}evaluate and {http://exslt.org/common}node-set, to do s.th. like <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dyn="http://exslt.org/dynamic" xmlns:exsl="http://exslt.org/common"> ... <!-- use the xpath expression given in the column definition to dynamically create the column value --> <xsl:variable name="calculated" select="current()/@calculated"/> <!-- select the current schema node, to provide evaluation context for the @calculated xpath expression --> <xsl:for-each select="$currentNode"> <xsl:text>"</xsl:text> <!-- Dynamically evaluate the "calculated" xpath expression. This had to be separated from the next exsl:node-set step to keep Xalan happy (no problem with xsltproc, though) --> <xsl:variable name="calculatedResult" select="dyn:evaluate ($calculated)"/> <!-- Using exsl:node-set converts plain text results to a text() node set, so we can use for-each regardless of what the executed xpath expression given in the @calculated attribute returns --> <xsl:for-each select="exsl:node-set($calculatedResult)"> Not through lxml but directly with xsltproc but I'm sure this will also just work with lxml.
I am mostly interested in the date function - http://www.exslt.org/ date/index.html - especially DateAdd: http://www.exslt.org/date/functions/add/index.html
Haven't used this function. If you don't care for usability of the stylesheet in a non-Python-context you might also consider using custom extension functions and XSLT extension elements: http://lxml.de/xpathxslt.html#dealing-with-stylesheet-complexity Holger Landesbank Baden-Wuerttemberg Anstalt des oeffentlichen Rechts Hauptsitze: Stuttgart, Karlsruhe, Mannheim, Mainz HRA 12704 Amtsgericht Stuttgart

Thanks for that example. I did not know, it was that easy. I read about Imports etc. Maybe this the point, why there is no XSLT 2 needed... Would it not be useful to add this to the XSLT wiki and at least one example? regards Henrik
reply to message: date: 28.04.2014 16:38:06 from: "Holger Joukl" <Holger.Joukl@LBBW.de> to: lxml@lxml.de subject: Re: [lxml] Antwort: XSLT 2
Von: "Henrik Genssen" thanks for you explanation as well.
Did anyone use http://www.exslt.org with lxml?
They seem to have many functions limbxml ready, but I could not find any examples using them with lxml or a recommendation for using it instead of XSLT2.
Yes, I've used some exslt stuff in the past, namely { http://exslt.org/dynamic}evaluate and {http://exslt.org/common}node-set, to do s.th. like
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dyn="http://exslt.org/dynamic" xmlns:exsl="http://exslt.org/common">
...
<!-- use the xpath expression given in the column definition to dynamically create the column value --> <xsl:variable name="calculated" select="current()/@calculated"/> <!-- select the current schema node, to provide evaluation context for the @calculated xpath expression --> <xsl:for-each select="$currentNode"> <xsl:text>"</xsl:text> <!-- Dynamically evaluate the "calculated" xpath expression. This had to be separated from the next exsl:node-set step to keep Xalan happy (no problem with xsltproc, though) --> <xsl:variable name="calculatedResult" select="dyn:evaluate ($calculated)"/> <!-- Using exsl:node-set converts plain text results to a text() node set, so we can use for-each regardless of what the executed xpath expression given in the @calculated attribute returns --> <xsl:for-each select="exsl:node-set($calculatedResult)">
Not through lxml but directly with xsltproc but I'm sure this will also just work with lxml.
I am mostly interested in the date function - http://www.exslt.org/ date/index.html - especially DateAdd: http://www.exslt.org/date/functions/add/index.html
Haven't used this function.
If you don't care for usability of the stylesheet in a non-Python-context you might also consider using custom extension functions and XSLT extension elements:
http://lxml.de/xpathxslt.html#dealing-with-stylesheet-complexity
Holger
Landesbank Baden-Wuerttemberg Anstalt des oeffentlichen Rechts Hauptsitze: Stuttgart, Karlsruhe, Mannheim, Mainz HRA 12704 Amtsgericht Stuttgart
_________________________________________________________________ Mailing list for the lxml Python XML toolkit - http://lxml.de/ lxml@lxml.de https://mailman-mail5.webfaction.com/listinfo/lxml

Henrik Genssen, 29.04.2014 09:56:
Thanks for that example. I did not know, it was that easy. I read about Imports etc.
Maybe this the point, why there is no XSLT 2 needed...
Would it not be useful to add this to the XSLT wiki and at least one example?
Not sure what "wiki" you mean, but any improvements to the docs would be appreciated. Please provide a pull request. You can also edit the pages in place on github if you prefer. https://github.com/lxml/lxml/tree/master/doc Stefan

reply to message: date: 29.04.2014 10:05:18 from: "Stefan Behnel" <stefan_ml@behnel.de> to: lxml@lxml.de subject: Re: [lxml] Antwort: XSLT 2
Henrik Genssen, 29.04.2014 09:56:
Thanks for that example. I did not know, it was that easy. I read about Imports etc.
Maybe this the point, why there is no XSLT 2 needed...
Would it not be useful to add this to the XSLT wiki and at least one example?
Not sure what "wiki" you mean, but any improvements to the docs would be appreciated. Please provide a pull request. You can also edit the pages in place on github if you prefer.
https://github.com/lxml/lxml/tree/master/doc
Stefan
I meant: http://lxml.de/xpathxslt.html that is: https://github.com/lxml/lxml/blob/master/doc/xpathxslt.txt ? regards, Henrik

Henrik Genssen, 29.04.2014 10:53:
reply to message: date: 29.04.2014 10:05:18 from: "Stefan Behnel" <stefan_ml@behnel.de> to: lxml@lxml.de subject: Re: [lxml] Antwort: XSLT 2
Henrik Genssen, 29.04.2014 09:56:
Thanks for that example. I did not know, it was that easy. I read about Imports etc.
Maybe this the point, why there is no XSLT 2 needed...
Would it not be useful to add this to the XSLT wiki and at least one example?
Not sure what "wiki" you mean, but any improvements to the docs would be appreciated. Please provide a pull request. You can also edit the pages in place on github if you prefer.
https://github.com/lxml/lxml/tree/master/doc
Stefan
I meant: http://lxml.de/xpathxslt.html
that is: https://github.com/lxml/lxml/blob/master/doc/xpathxslt.txt
Exactly. Stefan
participants (3)
-
Henrik Genssen
-
Holger Joukl
-
Stefan Behnel