我通过在error.log中重新加载页面来得到此错误:
必须指定源文档,初始模板或初始函数
这是我的PHP代码:
<?php
// INITIALIZE PROCESSOR
$saxonProc = new Saxon\SaxonProcessor();
$xsltProc = $saxonProc->newXsltProcessor();
$lang = $_GET['lang'];
$rubrik = $_GET['rubrik'];
$seite = $_GET['seite'];
// LOAD XSLT SCRIPT
$xslFile = "../ressources/xslt/transform_article_partials_to_html.xslt";
$xsltProc->compileFromFile($xslFile);
// SET PARAMS
$dir = __DIR__ . "/articles/" . $lang;
$filename = "{$rubrik}_{$seite}.html";
$filelist = scandir($dir, 1);
$xdmvalue = $saxonProc->createAtomicValue($filename);
$xsltProc->setParameter("articlePfad", $xdmvalue);
$xdmvalue = $saxonProc->createAtomicValue($lang);
$xsltProc->setParameter("lang", $xdmvalue);
// LOAD SOURCE XML
if($seite == null) {
$filename = "{$rubrik}.html";
if(in_array($filename, $filelist)) {
$xmlFile = $dir . "/" . $filename;
} else {
echo "404";
exit;
}
} else if(isset($seite) && isset($rubrik)){
if(in_array($filename, $filelist)) {
$xmlFile = $dir . "/" . $filename;
} else {
echo "404";
}
}
$xsltProc->setSourceFromFile($xmlFile);
// RUN TRANSFORMATION
$result = $xsltProc->transformToString();
echo $result;
// RELEASE RESOURCES
$xsltProc->clearParameters();
$xsltProc->clearProperties();
unset($xsltProc);
unset($saxonProc);
?>
我不知道错误在哪里。我不知道此错误是否中断了一些,因为它也可以处理该错误。在Google上,我没有发现此错误的任何内容。