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