1
翻譯文本時出現問題!XSL翻譯錯誤輸出
<text>This is a non breaking -</text>
<text>
<span style="">
<span style="">Testtext</span>
</span>
‑
<span style="">
<span style=""> some other text</span>
</span>
</text>
這是.xml文件我從CK編輯器和我有一個非中斷連字符的跨度之間獲得,但宋體不能顯示在我的.pdf文件這個非換連字符。我不允許更改.pdf的字體,因此我想將不分行連字符翻譯爲「正常」連字符。
<xsl:template match="text">
<fo:block>
<xsl:choose>
<xsl:when test="not(*) and contains(text(), '‑')">
<xsl:value-of select="translate(text(), '‑' , '-')"/>
</xsl:when>
<xsl:otherwise>
<xsl:if test="contains(text(), '‑')"> <!-- Here is my problem -->
<xsl:value-of select="translate(text(), '‑' , '-')"/>
<xsl:apply-templates />
</xsl:if>
<xsl:if test="not(contains(text(), '‑'))">
<xsl:apply-templates/>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</fo:block>
</xsl:template>
我現在的問題是,在if
與評論here is my problem
,當我在此之前是輸出不應用模板後:
This is a non breaking - //thats ok
-Testtext# some other text //thats not
但如果我aplly他們他們<xsl:value-of select=....
沒有按沒有工作。
它應該是這樣的:
This is a non breaking -
Testtext- some other text
完美,這是一個我沒有想到的點,像一個魅力 – glove40