1 回答

TA貢獻(xiàn)1788條經(jīng)驗(yàn) 獲得超4個(gè)贊
我想到了。
當(dāng)我最初刪除最后兩個(gè)選項(xiàng)和結(jié)束標(biāo)記時(shí),我留在了SELECT
XSL 樣式表中的開(kāi)始標(biāo)記中。這導(dǎo)致樣式表失敗,因?yàn)樗幸粋€(gè)沒(méi)有結(jié)束標(biāo)記的開(kāi)始標(biāo)記。一旦我SELECT
從 XSL 樣式表中刪除了標(biāo)記行并對(duì) PHP 進(jìn)行了以下更改,一切都完美無(wú)缺。
這是對(duì) PHP 的更改:
$openTag = '<select name="shipping_options" id="shipping_options">';
$closeTag = '<option value=\'8!!!0.00\'>Please call for freight pricing</option>
<option value=\'9!!!0.00\'>Please call for international pricing</option>
</select>';
....
else {
// save request and response to file
$fw = fopen ( $outputFileName, 'w' );
fwrite ( $fw, $response );
fclose ( $fw );
// Load XML file
$xml = new DOMDocument;
$xml->load($outputFileName);
// Load XSL file
$xsl = new DOMDocument;
$xsl->load('style.xsl');
// Configure the transformer
$proc = new XSLTProcessor;
// Attach the xsl rules
$proc->importStyleSheet($xsl);
echo $openTag;
echo $proc->transformToXML($xml);
if ($to_height > 0 && $to_height <= 2) {
echo $openTag . 'extra text here' . $closeTag;
}
else {
echo $openTag . $closeTag;
}
}
添加回答
舉報(bào)