Balisage logo

Preliminary Proceedings

Interactive web applications: demonstrating SaxonJS

Wendell Piez

Balisage: The Markup Conference 2017
August 1 - 4, 2017

Copyright © by the author.

How to cite this paper

Piez, Wendell. “Interactive web applications: demonstrating SaxonJS.” Presented at Balisage: The Markup Conference 2017, Washington, DC, August 1 - 4, 2017. In Proceedings of Balisage: The Markup Conference 2017. Balisage Series on Markup Technologies, vol. 19 (2017). doi:10.4242/BalisageVol19.Piez01.

Abstract

SaxonJS promises “real” XSLT in the browser. Old-timers are thrilled, cool kids are showing interest, and many people are very intrigued. The architecture is still characterized by a strong distinction between logical and presentation layers, but it is now possible to program user interaction in the browser as event-driven transformation logic, using XSLT alone. The unit of composition (the “work”) now corresponds to the unit of delivery (no longer a “page” but a “resource”). Most importantly, it is now possible to build and deploy interactive web sites with XML and XSLT alone -- no Java, no Javascript, no specialized server app or complex batch processing. But to deploy, you need a web server, a compiled XSLT stylesheet, and a certain amount of infrastructure. XML Jelly Sandwich, a starter XSLT hosted on GitHub, can provide infrastructure of sufficient quality for testing. Cool demos of TEI-tagged poetry and BITS-tagged prose meditations may help convince you to try SaxonJS.

Table of Contents

Old promise, new realization
The web is dead
But the browser has emerged as a platform
Opportunity of the moment
Why this may actually work
What about the business case
How it changes design
There is no irony here
What kinds of data, again?
Half-empty part
Getting started kit
Demonstrations
New ways to learn XSLT

Old promise, new realization

XSLT was originally designed with client-side processing in mind

This never / quite happened or did it? with XSLT 1.0

  • Yes, you can (sorta) get it to work ...

Impediments to this effort

  • No API or runtime interface to XSLT execution

  • Considerable limitations of XSLT 1.0

At long last, Saxonica offers a solution that addresses both problems

Background / context / problem: (lack of) business case for exposing XML (what?)

The web is dead

Several things killed it, including the predominant advertising-based sustainability model

The web is a big competition over placement and ranking in indexes

Bots and crawlers are more important than people, as "consumers"

Much information has retreated again behind pay walls

So hasn't XML in the browser missed its moment?

But the browser has emerged as a platform

Nevertheless the web subsists / evolves / matures as a capable medium because there must always be a "reductio" ("base") medium to which other media / channels can appeal

Thus it remains a way to get stuff in front of people

(One at a time if not en masse)

Meanwhile it has become more standard and stable with cross-browser scripting and CSS a priority

Opportunity of the moment

An XSLT processor capable of arbitrary transforms can be compiled and run under Javascript (who'da thunk it)

In the case of SaxonJS, the transformations (XSLT) must be compiled up front

Saxonica offers this feature under Saxon PE and EE licenses

Once XSLT is compiled, further use / sharing is free (no costs, licenses or registration for anyone)

Drop it onto a web server and go

Why this may actually work

SaxonJS is carefully placed on the strategic fine edge between standards-based and proprietary

As a proprietary platform it externalizes everything it can to the standards

  • E.g., already-owners of XML can reuse our same stylesheets (usually / almost)

This creates new possibilities of "information arbitrage" - power of XML at lower cost - to them that hath, shall be given

SaxonJS is licensed but your XML, XSLT, compiled SEF and design all belong to you

External dependency on http server + Javascript-capable browser(s) is – sustainable?

What about the business case

It's still difficult to argue for "giving away the semantics"

Yet - while XML can expose the source, with SaxonJS we get obfuscation of the processing, for free

(Yes, we can still obfuscate the source if we want to)

This places stress on XSLT (compiled into SEF) as (site of) "added value": not the information but its rendition (logic)

For some kinds of applications this might actually work

How it changes design

Emphasis goes back to the work as a whole, no longer so much "pages"

Multiple views and access points reflect peculiar semantics of the source data

Server doesn't disappear, just becomes a resource

Question: How about XForms under SaxonJS? (XRX with SaxonJS in front)

There is no irony here

SaxonJS is deployed in Javascript so we don't have to write Javascript

XSLT turns out to be really good at event handling!

  • HTML/CSS provide canvas and paints

  • XSLT is all the techniques of application

  • Matching elements in the (rendered) page is as easy as matching anywhere else

XML publication becomes its own archive

(Edit XML in git repo, then render via XSLT/SaxonJS?)

What kinds of data, again?

Product documentation

Standards, reference catalogs and authority files

Educational or not-for-profit publication

Public domain, government and open data sets

Half-empty part

Architecture is still a bit opaque and cumbersome

  • Um but compared to what?

  • Maybe we can help with that

You still gotta know XSLT (boy do you)

Development and debugging

Getting started kit

See github.com/wendellpiez/XMLjellysandwich

Set of stylesheets can produce:

  • "host" HTML landing page with syntax and callouts

  • "starter" XSLT with templa

  • normalized-as-standalone XML document copy

Demonstrations

New ways to learn XSLT

  • Client-side XSLT was always fun - until you hit the wall

  • Now we can better contemplate learning XSLT from the inside out

  • New forms of "meaningful learning application" should become possible

References

Delpratt, O'Neil, and Michael Kay. “Interactive XSLT in the browser.” Presented at Balisage: The Markup Conference 2013, Montréal, Canada, August 6 - 9, 2013. In Proceedings of Balisage: The Markup Conference 2013. Balisage Series on Markup Technologies, vol. 10 (2013). doi:10.4242/BalisageVol10.Delpratt01.

Lockett, Debbie, and Michael Kay. “Saxon-JS: XSLT 3.0 in the Browser.” Presented at Balisage: The Markup Conference 2016, Washington, DC, August 2 - 5, 2016. In Proceedings of Balisage: The Markup Conference 2016. Balisage Series on Markup Technologies, vol. 17 (2016). doi:10.4242/BalisageVol17.Lockett01.

Piez, Wendell. TEI Overlap Demonstration. (Saxon-CE demo in the browser.) See http://www.piez.org/wendell/projects/Interedition2011/

Piez, Wendell. XML Jigsaw. Project on Github at https://github.com/wendellpiez/XMLJigsaw

SaxonJS Documentation. From Saxonica. http://www.saxonica.com/saxon-js/documentation/

[sq_pan] SoftQuad Inc. SoftQuad Panorama product announcement, 1995. Archived at http://xml.coverpages.org/panofeat.html

oXygen XML Editor. From SyncroSoft. https://www.oxygenxml.com/

Wendell Piez

Wendell Piez is an independent consultant specializing in XML and XSLT, based in Rockville MD.