An example in the wild is the Unicode presentation that I gave at
Stuttgart XML User Group:
It’s an XPath 2 evaluation form.
I don’t remember exactly how I did it, but I remember that it wasn’t
trivial. Forensic investigation shows that it must have been along the
Include the following script/stylesheet:
<script type="application/xslt+xml" language="xslt2.0"
contains a template that matches the button’s click event.
It then recreates the div where the textarea and the button are in. It
fills it with copies of the textarea and the button, plus the result of
evaluating the XPath expression against the HTML document (try this by
evaluating, for example, /*/name() ⇒ HTML).
In order to be able to evaluate the XPath expression, you have to
generate an XSLT stylesheet first (evaluating an XPath expression
against a document could/should probably be made available as another
API function, but it hasn’t yet).
This is done by passing the XPath expression to the JS function
gerrit.generate_xpath_2_evaluator(), defined in
This stylesheet-generating JS is called from the original stylesheet by
means of the XPath extension function ixsl:eval().
gerrit.generate_xpath_2_evaluator() takes the XPath as a string argument
and passes it to another XSLT stylesheet
whose main template generates an XSLT stylesheet that, once applied to
the HTML document, creates an HTML div. This div’s content is just
This generated stylesheet is then passed as the second argument to
gerrit.apply_template_for_page_inclusion (also defined in
using the Saxon.run API function). The first argument is the HTML file,
to which the stylesheet is applied, and there you go.
I think this should give you a practical example to build your own
pipelined evaluation upon. And I hope that I didn’t make it
Most of the folks in Stuttgart probably didn’t appreciate or imagine the
enormous apparatus that was erected behind the scenes in order to make
an XPath2 form available in an HTML presentation.
[Advertisement: The next Stuttgart XML User Group meeting will take
place on Feb. 27 although it apparently hasn’t been announced yet on
http://xugs.de/. I think Andreas Kämmerle of pagina GmbH will discuss
EPUB3 and KF8.]
On 18.02.2013 22:29, Michael Kay wrote:
> Sorry, I can't lay my hands on an example. You'll need to use the
> with XSLT 1.0 processors in the browser. The documentation is here:
> Basically, you parse the stylesheet into a document object; call
> Saxon.newXslt20Transformer() to compile the stylesheet to an
> Xslt20Transformer; then call Xslt20Transformer.transformToDocument() to
> transform a source document; the result returned is a Document object
> which can then be used as input to the next step in the pipeline.
> Michael Kay
> On 18/02/2013 07:56, mbyrne@... wrote:
>> Hi all,
>> Looking through all Saxon-CE examples online, i can't find a basic
>> example of a pipeline:
>> 1. load xml, transform with xsl sheet
>> 2. load second xsl sheet, transform result of first transformation
>> Can anyone post a link or some code that shows how to do this? It
>> would be a good addition to the online documentation.
>> Best regards,
>> - Myles
>> Institute Molecular Medicine Finland
>> The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
>> is your hub for all things parallel software development, from weekly thought
>> leadership blogs to news, videos, case studies, tutorials, tech docs,
>> whitepapers, evaluation guides, and opinion stories. Check out the most
>> recent posts - join the conversation now. http://goparallel.sourceforge.net/
>> saxon-help mailing list archived at http://saxon.markmail.org/
> The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
> is your hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials, tech docs,
> whitepapers, evaluation guides, and opinion stories. Check out the most
> recent posts - join the conversation now. http://goparallel.sourceforge.net/
> saxon-help mailing list archived at http://saxon.markmail.org/
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930
Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vöckler