1
我試圖解析這個XML換行和空格,而在表
<ssa_admin_tablereports>
<ssa_admin_tablereport_property name='ADM' value=' Tables :0 Partitions : 0 Files : 0 Total size (Archive) : 0 Total size (Update) : 0 Total size (Arc/Upd) : 0%/0% Total size : 0 Total rows : 0 Flat file size (Archive): 0 Flat file size (Update) : 0 Flat file size (Arc/Upd): 0%/0% Flat file size : 0 Compression ratio : not defined '>
</ssa_admin_tablereport_property>
<ssa_admin_tablereport_property name='TORRENT' value=' Tables : 53 Partitions : 97 Files : 194 Total size (Archive) : 1980098 Total size (Update) : 586499 Total size (Arc/Upd) : 77%/23% Total size : 2566597 Total rows : 213404 Flat file size (Archive): 9189418 Flat file size (Update) : 6830067 Flat file size (Arc/Upd): 57%/43% Flat file size : 16019485 Compression ratio : 84.0% '>
</ssa_admin_tablereport_property>
</ssa_admin_tablereports>
用於此的XSLT是解析使用XSLT多行XML屬性值崩潰:
<pre><dd>
<table border="1">
<tbody>
<tr>
<th>Table Name</th>
<th>Table Report</th>
</tr>
<xsl:for-each select="ssa_admin_tablereports/ssa_admin_tablereport_property">
<tr>
<td valign="top"><xsl:value-of select="@name"/></td>
<td valign="top"><xsl:value-of select="@value"/></td>
</tr>
</xsl:for-each>
</tbody>
</table>
</dd></pre>
但是當我打開帶有瀏覽器的XML文件,值屬性中出現的換行符和空格被替換爲單個空格。那麼我怎樣才能以與XML相同的方式獲得它?
呀,現在它的工作。謝謝伊恩羅伯茨 – Prateek