我試圖把空間/在我的HTML表中的列縮進文本。我正在使用XSLT 1.0讀取XML文件並將其寫入HTML文件。我曾嘗試以下:
<?xml version='1.0' encoding='utf-16'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes" encoding="utf-16"/>
<tr>
<td/>
<td>
<xsl:text xml:space="preserve"> </xsl:text>
<xsl:value-of select="concat('Substantiation-',
@sourceID, ' (', current(), ')')"/>
</td>
</tr>
結果(從生成的HTML文件打開),在Internet Explorer中查看時的樣子:
 Substantiation-9010 (p 1-5, Para 1-10.)
我也tryed 	
, 
和 
有相似或沒有結果。
我假設我有一個編碼問題(感謝邁克爾凱指出),但我不知道我做錯了,因爲我在輸出標記中指定編碼。有誰知道如何添加空格/選項卡,以便在IE中查看時看起來正確?
謝謝你的幫助!
'xsl:text'指令不需要'@xml:space =「preserve」'。這與XSLT無關。實際上,該轉換正確添加了#x9,#x20和#xA字符引用。 **瀏覽器正確地標準化他們**。 – 2011-02-18 22:14:31
謝謝亞歷杭德羅。我已經刪除它。 – Billy