Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
XSLT and Entities
<!ENTITY world "world">
<!ENTITY copy "&#169;">
<!DOCTYPE xsl:stylesheet [
<!ENTITY world "world">
<!ENTITY copy "&#169;">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="no" method="html" indent='yes' />
<xsl:template match="/">
<xsl:text disable-output-escaping="yes">&lt;</xsl:text>!DOCTYPE html<xsl:text disable-output-escaping="yes">&gt;&#10;</xsl:text>
<head>
<title>Test</title>
</head>
<body>
<h1>Hello &world;</h1>
<p>Look at me using crazy entities like &copy;.</p>
</body>
</xsl:template>
</xsl:stylesheet>
<!DOCTYPE xsl:stylesheet [
<!ENTITY % entities SYSTEM "entities.dtd">
%entities;
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="no" method="html" indent='yes' />
<xsl:template match="/">
<xsl:text disable-output-escaping="yes">&lt;</xsl:text>!DOCTYPE html<xsl:text disable-output-escaping="yes">&gt;&#10;</xsl:text>
<head>
<title>Test</title>
</head>
<body>
<h1>Hello &world;</h1>
<p>Look at me using crazy entities like &copy;.</p>
</body>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment