This is an Open Web Archive archive of https://gitlab.dyomedea.com/presentations/xmlamsterdam2013/blob/master/serialization.xsl.
This snapshot has been taken on 2014-01-08 21:00:43 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
serialization.xsl 2.03 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
 55
 56
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright © 2013 Eric van der Vlist <vdv@dyomedea.com>
See license information at the bottom of this file
-->

<?pi a pi ?>
<!-- A comment -->
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:d="http://dyomedea.com"
xmlns:js="http://saxonica.com/ns/globalJS">

<xsl:import href="xml-to-string.xsl"/>

<xsl:param name="exclude-unused-prefixes" select="false()"/>

<xsl:function name="d:serializeXML" as="xs:string">
<xsl:param name="node" as="node()"/>
<xsl:variable name="doc" as="document-node()">
<xsl:document>
<xsl:sequence select="$node"/>
</xsl:document>
</xsl:variable>
<xsl:variable name="result">
<xsl:apply-templates select="$doc" mode="xml-to-string"/>
</xsl:variable>
<xsl:sequence select="string-join($result, '')"/>
</xsl:function>

<xsl:function name="d:convert-to-jsdom">
<xsl:param name="node" as="node()"/>
<xsl:sequence select="js:Saxon.parseXML(d:serializeXML($node))"/>
</xsl:function>

</xsl:stylesheet>
<!--
Copyright © 2013 Eric van der Vlist <vdv@dyomedea.com>
This file is part of
<https://gitlab.dyomedea.com/public/projects/presentations/xmlamsterdam2013>.
This sotfware is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This sotfware is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library. If not, see <http://www.gnu.org/licenses/>.
-->