wendellpiez / xmljellysandwich Goto Github PK
View Code? Open in Web Editor NEWStarter kit for XSLT 3.0 in the browser using SaxonJS
License: MIT License
Starter kit for XSLT 3.0 in the browser using SaxonJS
License: MIT License
Here is a suggestion for updating a particular section of the README markdown file. Since it is written in gfmd, it will show up on this ticket rendered. But I believe if you copy-and-paste (or edit the ticket) you can access the markdown. I have inserted questions surrounded by guillemets in bold.
The HTML (or XHTML) ‘hosting’ file is the landing page that is loaded into the user’s browser to kick everything else off. You can create one by copying and then altering any one of the index.html
files from one of the docs/*/
directories of this repository, or by using the “starter maker” XSLT program described below.
Either way, the ‘hosting’ HTML page needs a few control points:
script[@src='lib/saxon/SaxonJS.min.js']
, or equivalent. The named Javascript file must be in the location mentioned<script type="text/javascript"
src="../lib/saxon/SaxonJS.min.js"><!-- cosmetic comment --></script>
script
element the SaxonJS.transform() function should be set up with settings for your source XML and your SEF (compiled XSLT). In the example below {$resource_filename}
should be the path to the XML file you plan to deliver. «?wp is path relative from the hosting file or the .sef file?» The {$transform_href}
should point to your your SEF. «?wp same Q?» The {$xmljellysandwich_pack}
identifies the entry point for the stylesheet (this names a template appearing in XSLTs produced by the starter-maker, but your XSLT could offer its own entry points). Adjust as necessary for your XSLT.<script>
window.onload = function() {
SaxonJS.transform({
sourceLocation: "{$resource_filename}",
stylesheetLocation: "{$transform_href}",
initialTemplate: "xmljellysandwich_pack"
});
}
</script>
<body>
element of the HTML, or somewhere inside it, make sure to put in a dummy element that has an @id
attribute. This dummy element will be replaced with whatever the SEFed stylesheet writes to that ID using <xsl:result-document>
. The hostHTMLfile-maker.xsl program (described below) uses the IDs “header”, “directory”, “body”, and “footer”, each prefixed with “xmljellysandwich_”. These dummy elements (which could be just one element, the entire <body>
, if you like) will be replaced by a <xsl:result-document>
instruction in the XSLT-turned-SEF.”.Note that these and many other runtime options for SaxonJS are documented at http://www.saxonica.com/saxon-js/documentation/index.html#!api/transform.
You are done with the host file. (You can come back.)
This hint probably belongs into the core Saxon-JS documentation, but I was unable to find it there.
I developed a small application with a textarea
. I was surprised to see that rendering its content would only give me the placeholder text that I put into the HTML source, rather than the text that was entered by the user. Then I remembered that I had the same issue with a program that I wrote with Saxon CE six (!) years ago. I looked up how I solved it: With @prop:value
. Then I read about ixsl:get()
that is meant to replace the @prop:*
attributes. I figured out that I need to use something like ixsl:get(id('area1',ixsl:page()), 'value')
.
I suggest that we use the Wiki of this repo in order to document hints like this, ideally pointing to projects where the techniques are being employed. (I’ll add my current tiny project to Github soon.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.