Re: [lxml] Antwort: XSLT 2

(cc-ing the list)
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:
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?

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.
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

Henrik Genssen, 29.04.2014 09:56:
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

Holger Joukl, 25.04.2014 16:48:
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?

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.
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

Henrik Genssen, 29.04.2014 09:56:
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
participants (3)
-
Henrik Genssen
-
Holger Joukl
-
Stefan Behnel