This is an Open Web Archive archive of https://gitlab.dyomedea.com/presentations/xmlamsterdam2013/blob/master/hello-world-2xslt.xsl.
This snapshot has been taken on 2014-01-08 21:22:44 for the website Eric van der Vlist which contains a link to this page and has saved a copy to be displayed in the page ever disappears.
presentations / XML Amsterdam 2013 | GitLab
hello-world-2xslt.xsl 2.2 KB
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ixsl="http://saxonica.com/ns/interactiveXSLT"
xmlns:js="http://saxonica.com/ns/globalJS" xmlns:d="http://dyomedea.com"
xmlns:prop="http://saxonica.com/ns/html-property" extension-element-prefixes="ixsl"
exclude-result-prefixes="prop js d xs" version="2.0">

<xsl:import href="serialization.xsl"/>
<xsl:import href="events.xsl"/>
<xsl:include href="saxon-ce-dummy-declarations.xsl"/>

<xsl:template name="init">
<xsl:variable name="instance0" as="node()">
<data>
<person-given-name/>
</data>
</xsl:variable>
<xsl:variable name="instance" select="d:convert-to-jsdom($instance0)"/>
<ixsl:set-property name="instance" select="$instance"/>
<ixsl:set-property name="dummy"
select="d:apply-update-transformation(xs:anyURI('hello-world-2xslt2.xsl'), $instance, 'init')"
/>
</xsl:template>

<!-- The input box has changed -->
<xsl:template match="input[@id='input']" mode="ixsl:onchange">
<xsl:message>The input box has been changed</xsl:message>
<xsl:variable name="instance" select="ixsl:get(ixsl:window(), 'instance')"/>
<xsl:variable name="event" select="d:new-custom-event('ModelUpdate')"/>
<ixsl:set-property object="$event" name="detail.value" select="string(@prop:value)"/>
<ixsl:set-property name="dummy"
select="d:dispatch-event-to-instance($instance/data/person-given-name, $event)"/>
</xsl:template>
<!-- The output needs to be updated -->
<xsl:template match="div[@id='output']" mode="ixsl:onchange">
<xsl:message>The output needs to be updated</xsl:message>
<xsl:variable name="instance" select="ixsl:get(ixsl:window(), 'instance')"/>
<xsl:result-document href="#output" method="ixsl:replace-content">
<xsl:text>Hello </xsl:text>
<xsl:value-of select="$instance/data/person-given-name"/>
<xsl:text>. We hope you like Saxon CE!</xsl:text>
</xsl:result-document>
</xsl:template>
</xsl:stylesheet>