3
不是「正常化」的空格,我有一個像如何「崩潰」,但在XLST
<p> In trattoria scoprii che c'era <del rend="tratto a matita">anche</del> Mirella,
non la non vedevo da almeno sei anni.
La spianata dava infatti l'impressione di fango secco, <del rend="matita">divorato
dalle rughe</del><add place="margine sinistro" rend="matita">attraversato da
lunghe ferite nere</add>. Lontano si vedeva una montagna di creta dello
stesso colore della mota. </p>
我使用這個樣式表刪除空格,在兩個部件之間和文本節點中的XML /亭。
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="*">
<xsl:copy>
<xsl:for-each select="@*">
<xsl:attribute name="{name()}">
<xsl:value-of select="normalize-space()"/>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="normalize-space()"/>
</xsl:template>
一切順利exept爲標準化空間的事實()移除還領導和traling空格,所以我有這樣
c'era<del rend="tratto a matita">anche</del>Mirella
我不能排除混合模式內容的一些undesidered行爲形成刪除,因爲我的第一個需要是崩潰 whitespaces像返回,製表符,標識INSIDE,說,<p>
元素。
是否有一種方法/函數/技巧來摺疊單個空格中的多個空格而不刪除前導空格和尾部空格?
謝謝。它工作,但與選擇=「替換(。,'(\ s \ s +)','')」 – Mycol 2010-06-09 16:00:26
優秀。我很有興趣知道你在處理XSLT時使用了什麼,因爲我不能100%確定這是完全可移植的。 – 2010-06-09 17:05:47
撒克遜9.2家庭版 – Mycol 2010-06-09 18:33:41