コード例 #1
0
ファイル: xslt010.php プロジェクト: badlamer/hhvm
<?php

echo "Test 10: EXSLT Support";
$dom = new domDocument();
$dom->load(dirname(__FILE__) . "/exslt.xsl");
$proc = new xsltprocessor();
$xsl = $proc->importStylesheet($dom);
$xml = new DomDocument();
$xml->load(dirname(__FILE__) . "/exslt.xml");
print $proc->transformToXml($xml);
コード例 #2
0
ファイル: xslt011.php プロジェクト: dw4dev/Phalanger
    function foo()
    {
    }
    function __toString()
    {
        return "not a DomNode object";
    }
}
$dom = new domDocument();
$dom->load(dirname(__FILE__) . "/xslt011.xsl");
$proc = new xsltprocessor();
$xsl = $proc->importStylesheet($dom);
$xml = new DomDocument();
$xml->load(dirname(__FILE__) . "/xslt011.xml");
$proc->registerPHPFunctions();
print __xml_norm($proc->transformToXml($xml));
function foobar($id, $secondArg = "")
{
    if (is_array($id)) {
        return $id[0]->value . " - " . $secondArg;
    } else {
        return $id . " - " . $secondArg;
    }
}
function nodeSet($id = null)
{
    if ($id and is_array($id)) {
        return $id[0];
    } else {
        $dom = new domdocument();
        $dom->loadXML("<root>this is from an external DomDocument</root>");
コード例 #3
0
ファイル: bug26384.php プロジェクト: badlamer/hhvm
<?php

$dom = new domDocument();
$dom->load(dirname(__FILE__) . "/area_name.xml");
if (!$dom) {
    echo "Error while parsing the document\n";
    exit;
}
$xsl = new domDocument();
$xsl->load(dirname(__FILE__) . "/area_list.xsl");
if (!$xsl) {
    echo "Error while parsing the document\n";
    exit;
}
$proc = new xsltprocessor();
if (!$proc) {
    echo "Error while making xsltprocessor object\n";
    exit;
}
$proc->importStylesheet($xsl);
print $proc->transformToXml($dom);
//this segfaulted before
print $dom->documentElement->firstChild->nextSibling->nodeName;
コード例 #4
0
ファイル: printerfriendly.php プロジェクト: iplaydu/xml1
<?php

include "header.php";
$xslDir = "xslt/";
//detect our incoming content
$incoming = $_GET['id'];
if (eregi("article", $incoming)) {
    $xslt = $xslDir . "articles.xsl";
} elseif (eregi("webcopy", $incoming) or eregi("homepage", $incoming)) {
    $xslt = $xslDir . "webcopy.xsl";
}
$dom = new domDocument();
$dom->load($xslt);
$proc = new xsltprocessor();
$xsl = $proc->importStylesheet($dom);
$document = new DomDocument();
$document->load($fileDir . $incoming . ".xml");
print $proc->transformToXml($document);
?>