Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set('display_errors', 1);
- ini_set('display_startup_errors', 1);
- error_reporting(E_ALL);
- $myxsl = <<<EOF
- <?xml version="1.0" encoding="UTF-8"?>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:php="http://php.net/xsl">
- <xsl:template match="/">
- <xsl:call-template name="recurse"/>
- </xsl:template>
- <xsl:template name="recurse">
- <xsl:param name="COUNT">1</xsl:param>
- <xsl:value-of select="php:function('stupid', %COUNT)"/>
- <xsl:if test="not(count(//Frog) = 4)">
- <xsl:call-template name="recurse">
- <xsl:with-param name="COUNT" select="%COUNT + 1"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
- </xsl:stylesheet>
- EOF;
- $myxsl = str_replace('%', '$', $myxsl);
- function stupid($message) {
- echo "$message\n\n";
- flush();
- return 'yo';
- }
- $myxml = <<<EOF
- <Whatever>
- <Frog>frog</Frog></Whatever>
- EOF;
- $xsl = new DOMDocument();
- $xsl->loadXML($myxsl);
- $dom0 = new DOMDocument();
- $dom0->loadXML($myxml);
- $proc = new XSLTProcessor;
- $proc->registerPHPFunctions();
- $proc->importStyleSheet($xsl);
- $dom2 = $proc->transformToDoc($dom0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement