私はHTMLを生成するはずのこの非常に単純なコードを持っていますが、私が得るのはホワイトページだけです。 私は何かを試してみました。誰かが私が何を間違えているかを確認して教えてもらえれば、私は天にいます!XMLをHTMLに変換する - PHPとXLSテンプレートを使用する
PHPコード:
$xp = new XsltProcessor();
// create a DOM document and load the XSL stylesheet
$xsl = new DomDocument;
$xsl->load('template-file.xls');
// import the XSL styelsheet into the XSLT process
$xp->importStylesheet($xsl);
// create a DOM document and load the XML datat
$xml_doc = new DomDocument;
$xml_doc->load('temporary-file.xml');
// transform the XML into HTML using the XSL file
if ($html = $xp->transformToXML($xml_doc)) {
return $html;
} else {
return "<p>FAILED</p>";
}
XMLファイル:
<?xml version="1.0"?>
<results>
<xml_report>
<subject>
<efx_file_header>
<efx_header>
<bureau>EFX</bureau>
<customer_number>682ZB08042</customer_number>
<customer_reference_code>199</customer_reference_code>
<ecoa>2</ecoa>
<output_format>02</output_format>
<multiple_files_indicator>1</multiple_files_indicator>
<name>ZUVICH, TYLER J</name>
<ssn>196722017</ssn>
</efx_header>
</efx_file_header>
</subject>
</xml_report>
</results>
そして、これは、XLSテンプレートファイルです:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:php="http://php.net/xsl"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Edited by Adrian -->
<xsl:output method="html" encoding="UTF-8" indent="yes"/>
<xsl:template match="results/xml_report">
<xsl:for-each select="subject">
<table class="table-paddings" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="245px">Boreau</td>
<td width="250px"><xsl:value-of select="efx_file_header/ext_header/bureau" /></td>
</tr>
<tr>
<td>Customer Number</td>
<td><xsl:value-of select="efx_file_header/ext_header/customer_number" /></td>
</tr>
<tr>
<td>Customer Reference Code</td>
<td><xsl:value-of select="efx_file_header/ext_header/customer_reference_code" /></td>
</tr>
</tbody>
</table>
<br />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
表示エラーがオンになっていますか?エラー報告はE_ALLに設定されていますか? – Hajo
@Hajo私はそれをしました。エラーはありません:S – ProDraz
すべてのファイルがphpで見つけられ/ロードされていて、それらがdomで処理される前に期待されるデータを含んでいればチェックされていますか? – Hajo