Skip to content

Instantly share code, notes, and snippets.

@niratama
Created December 19, 2013 11:12
Show Gist options
  • Save niratama/8037668 to your computer and use it in GitHub Desktop.
Save niratama/8037668 to your computer and use it in GitHub Desktop.
FirefoxとIE/Safari/Chromeで挙動の違うXSLT
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<article title="hello!">
<content><![CDATA[
<div style="text-align: center;">Hello, world!</div>
]]></content>
</article>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8" />
<xsl:variable name="content" select="/article/content" />
<xsl:variable name="bar" select="'&lt;hr>'" />
<xsl:template match="/">
<html>
<head>
<title><xsl:value-of select="/article/@title" /></title>
<meta http-equiv="conetnt-type" content="text/html; charset=UTF-8" />
</head>
<body>
<xsl:value-of disable-output-escaping="yes" select="$bar" />
<xsl:value-of disable-output-escaping="yes" select="$content" />
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment