Skip to content

Instantly share code, notes, and snippets.

@tecumsehmaverick
Forked from brendo/entities.dtd
Created January 23, 2017 02:02
Show Gist options
  • Save tecumsehmaverick/f31fe1dd0a933c64f5139d51bcc0a04c to your computer and use it in GitHub Desktop.
Save tecumsehmaverick/f31fe1dd0a933c64f5139d51bcc0a04c to your computer and use it in GitHub Desktop.
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