【发布时间】:2018-02-01 15:02:39
【问题描述】:
我正在使用 XSLT Dita OT 生成 PDF 文件。 对于发布过程,可以生成 EN、FR、DE、IT 中的翻译文件。现在我使用下面的代码来管理我的输出。
在这种情况下,语言是元数据,这就是我使用“@ 属性”的原因
但在发布我的代码后它无法正常工作。有人可以帮我解决这个问题吗?
<xsl:choose>
<xsl:when test="@xml:lang = 'EN'">
<fo:block-container xsl:use-attribute-sets="languagecontainer" top="25mm">
<fo:block xsl:use-attribute-sets="languageblock">ENGLISH</fo:block>
</fo:block-container>
</xsl:when>
<xsl:when test="@xml:lang = 'FR'">
<fo:block-container xsl:use-attribute-sets="languagecontainer" top="55mm">
<fo:block xsl:use-attribute-sets="languageblock">FRANÇAIS</fo:block>
</fo:block-container>
</xsl:when>
<xsl:when test="@xml:lang = 'DE'">
<fo:block-container xsl:use-attribute-sets="languagecontainer" top="85mm">
<fo:block xsl:use-attribute-sets="languageblock">DEUTSCH</fo:block>
</fo:block-container>
</xsl:when>
<xsl:when test="@xml:lang = 'IT'">
<fo:block-container xsl:use-attribute-sets="languagecontainer" top="115mm">
<fo:block xsl:use-attribute-sets="languageblock">ITALIANO</fo:block>
</fo:block-container>
</xsl:when>
<xsl:when test="@xml:lang = 'ES'">
<fo:block-container xsl:use-attribute-sets="languagecontainer" top="145mm">
<fo:block xsl:use-attribute-sets="languageblock">ESPAÑOL</fo:block>
</fo:block-container>
</xsl:when>
<xsl:otherwise>
<fo:block>
<xsl:text>no result</xsl:text>
</fo:block>
</xsl:otherwise>
【问题讨论】:
-
我对 XSLT 一无所知,但你会想要更新你的答案,说一些不那么模糊的东西,而不是它不起作用。
-
当您没有显示输入并且没有告诉我们预期输出或实际输出时,我们怎么可能知道为什么您的代码不起作用?您向我们展示的代码 sn-p 没有任何明显错误。
-
你的代码比它需要的要冗长得多,但你应该在尝试重构它之前找出它为什么不起作用。