This is an Open Web Archive archive of https://gitlab.dyomedea.com/presentations/xmlamsterdam2013/blob/master/hello-world-mvc.xsl.
This snapshot has been taken on 2014-01-08 21:34:15 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-mvc.xsl 2.26 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
 48
 49
 50
 51
 52
 53
 54
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ixsl="http://saxonica.com/ns/interactiveXSLT" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:prop="http://saxonica.com/ns/html-property" xmlns:d="http://dyomedea.com"
extension-element-prefixes="ixsl" exclude-result-prefixes="xs d prop" version="2.0">

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

<xsl:template name="init">
<xsl:variable name="instance">
<data>
<person-given-name/>
</data>
</xsl:variable>
<ixsl:set-property object="ixsl:window()" name="instance"
select="d:convert-to-jsdom($instance)"/>
</xsl:template>

<xsl:template match="input[@id='input']" mode="ixsl:onchange">
<!-- "Get" the previous instance -->
<xsl:variable name="previous-instance" select="ixsl:get(ixsl:window(), 'instance')"/>
<!-- Update it -->
<xsl:variable name="instance">
<xsl:apply-templates select="$previous-instance" mode="update-person-given-name">
<xsl:with-param name="value" select="@prop:value" tunnel="yes"/>
</xsl:apply-templates>
</xsl:variable>
<!-- Store the new value -->
<ixsl:set-property object="ixsl:window()" name="instance"
select="d:convert-to-jsdom($instance)"/>
<!-- Rely on the instance to write the output -->
<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:template match="@*|node()" mode="update-person-given-name">
<xsl:copy>
<xsl:apply-templates select="@*|node()" mode="#current"/>
</xsl:copy>
</xsl:template>

<xsl:template match="person-given-name" mode="update-person-given-name">
<xsl:param name="value" tunnel="yes"/>
<xsl:copy>
<xsl:apply-templates select="@*" mode="#current"/>
<xsl:value-of select="$value"/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>