<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:pf="http://www.daisy.org/ns/pipeline/functions" xmlns:Library="org.daisy.pipeline.word_to_dtbook.impl.DTBookCleanerLibrary" version="2.0" exclude-result-prefixes="#all">
<xsl:function name="pf:default-locale" as="xs:string">
<xsl:value-of select="Library:getDefaultLocale()">
</xsl:value-of>
</xsl:function>
<xsl:template match="*" mode="serialize">
<xsl:text></xsl:text>
<xsl:value-of select="name()"/>
<xsl:apply-templates select="@*" mode="serialize"/>
<xsl:choose>
<xsl:when test="node()">
<xsl:text>�</xsl:text>
<xsl:apply-templates mode="serialize"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="name()"/>
<xsl:text>�</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> /�</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="@*" mode="serialize">
<xsl:text> </xsl:text>
<xsl:value-of select="name()"/>
<xsl:text>="</xsl:text>
<xsl:value-of select="."/>
<xsl:text>"</xsl:text>
</xsl:template>
<xsl:template match="text()" mode="serialize">
<xsl:value-of disable-output-escaping="yes" select="."/>
</xsl:template>
<xsl:template name="un-serialize">
<xsl:param name="text"/>
<xsl:choose>
<xsl:when test="$text = ''">
<xsl:value-of select="$text"/>
</xsl:when>
<xsl:when test="contains($text, '')">
<xsl:value-of select="substring-before($text,'')"/>
<xsl:value-of disable-output-escaping="yes" select="'<'"/>
<xsl:value-of select="substring-before(substring-after($text,''), '�')"/>
<xsl:value-of disable-output-escaping="yes" select="'>'"/>
<xsl:call-template name="un-serialize">
<xsl:with-param name="text" select="substring-after($text,'�')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>