Skip to content

Instantly share code, notes, and snippets.

@ccontavalli
Last active April 18, 2019 15:39
Show Gist options
  • Save ccontavalli/1291615 to your computer and use it in GitHub Desktop.
Save ccontavalli/1291615 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="test.xsl" media="all"?>
<tag>
This is a very very simple xml document.
</tag>
<?xml version="1.0" encoding="UTF-8"?>
<!-- WARNING! With versions of mod-xslt < 1.4.3, you need to use
"www.mod-xslt2.com" in xmlns:yaslt=... -->
<xsl:stylesheet version="1.0" extension-element-prefixes="yaslt"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:yaslt="http://www.modxslt.org/ns/1.0">
<xsl:output method="html" omit-xml-declaration="yes" indent="yes" encoding="UTF8" />
<xsl:strip-space elements="*" />
<xsl:template match="/">
<html>
<head>
<title>mod-xslt is working!</title>
</head>
<body>
<h1>mod-xslt is working!</h1>
Compile time constants:
<ul>
<li>mod-xslt version: <b><xsl:value-of select="$modxslt-name" /> - <xsl:value-of select="$modxslt-version" /></b></li>
<li>mod-xslt namespace: <b><xsl:value-of select="$modxslt-namespace" /></b></li>
<li>mod-xslt handler: <b><xsl:value-of select="$modxslt-handler" /></b></li>
<li>mod-xslt conf-libpcre: <b><xsl:value-of select="$modxslt-conf-libpcre" /></b></li>
<li>mod-xslt conf-exslt: <b><xsl:value-of select="$modxslt-conf-exslt" /></b></li>
<li>mod-xslt conf-extensions: <b><xsl:value-of select="$modxslt-conf-extensions" /></b></li>
<li>mod-xslt conf-libxmlthreads: <b><xsl:value-of select="$modxslt-conf-libxmlthreads" /></b></li>
<li>mod-xslt conf-libxslthack: <b><xsl:value-of select="$modxslt-conf-libxslthack" /></b></li>
<li>mod-xslt conf-fallbackwrap: <b><xsl:value-of select="$modxslt-conf-fallbackwrap" /></b></li>
<li>mod-xslt conf-thread: <b><xsl:value-of select="$modxslt-conf-thread" /></b></li>
<li>mod-xslt conf-xinclude: <b><xsl:value-of select="$modxslt-conf-xinclude" /></b></li>
</ul>
mod-xslt extensions:
<ul>
<li>User-Agent header:
<b><yaslt:value-of select="$HEADER[User-Agent])"><xsl:fallback><font color="red">NOT WORKING!</font></xsl:fallback></yaslt:value-of></b>
</li>
<li>Get parameter (id, try to get this page with ?id=testidorsomething):
<b><yaslt:value-of select="$GET[id])"><xsl:fallback><b><font color="red">NOT WORKING!</font></b></xsl:fallback></yaslt:value-of></b>
</li>
</ul>
Text in .xml file (boldified):
<b><xsl:apply-templates/></b>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment