我正在使用xsl-file" generate_document_structure.xsl"并且对这个旧结构并不熟悉。
我的目标是,如果METADATA中的语言为FA或AR,则将写入模式从lr-tb更改为rl-tb。
来自ouputfolder的清理代码
<?xml version="1.0" encoding="UTF-8"?>
<fctdcl>
<publicationinfo dclselection="SelectedNode">
<props>
<attrblock type="1toN" name="language">
<attrlist>
<attrdesc id="1" name="language"/>
</attrlist>
<attrrec>
<attrval id="1">Default</attrval>
</attrrec>
</attrblock>
</props>
</publicationinfo>
如果语言为FA,我对如何建立与METADATA的连接是一个很大的猜测。换句话说,我正在寻找到METADATA的wright xpath并选择它的值。
我想的方式如下:
<xsl:variable name="language">
<xsl:value-of select="//*[contains(@class, ' /FCTDocuments/metadata/@language ')]/@content"></xsl:value-of>
</xsl:variable>
<xsl:choose>
<xsl:when test="$language = 'FA'">
<xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
</xsl:when>
</xsl:choose>
如果有人能帮助我,我将不胜感激
答案 0 :(得分:0)
@Toni,
我用它做了一些步骤。
在我当前的档案下面。
<xsl:template name="FoT_page-sequence_ContentSequence">
<xsl:choose>
<xsl:when test="not(/FCTDocuments/chapter)">
<fo:page-sequence master-reference="ContentSequence">
<xsl:call-template name="AddHyphenationToSequence"/>
<xsl:call-template name="chapter_header_footer_without_config"/>
<fo:flow flow-name="xsl-region-body" xsl:use-attribute-sets="XSL_Content">
<fo:block id="last-page"/>
</fo:flow>
</fo:page-sequence>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="/FCTDocuments/chapter">
<fo:page-sequence master-reference="ContentSequence" initial-page-number="auto-odd" writing-mode="rl-tb"> <!---->
<xsl:if test="/FCTDocuments/@RSKM-ProductType = 'MM' ">
<xsl:attribute name="initial-page-number">
<xsl:text>1</xsl:text>
</xsl:attribute>
</xsl:if>
<fo:flow flow-name="xsl-region-body" xsl:use-attribute-sets="XSL_Content">
<xsl:if test="count(preceding-sibling::chapter) = 0">
<xsl:if test="$DEBUG = 'true'">
<!-- write debug informations -->
<xsl:comment>
<xsl:text>DEBUG: Starting Content creation</xsl:text>
</xsl:comment>
</xsl:if>
<fo:block>
<fo:marker marker-class-name="DOCUMENTNAME">
<xsl:value-of select="/FCTDocuments/Cover/CoverTitle"/>
</fo:marker>
<fo:marker marker-class-name="DOCUMENTINFO">
<xsl:value-of select="$DOCUMENTINFO"/>
</fo:marker>
</fo:block>
</xsl:if>
<xsl:apply-templates select="."/>
<xsl:if test="count(following-sibling::chapter) = 0">
<fo:block id="last-page"/>
</xsl:if>
</fo:flow>
</fo:page-sequence>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
当我们放大下面的代码部分时,我在fo:page-sequence中添加了attribure“writing-mode”。经过测试,它运行良好,但这只有在语言为FA时才会发生
所以我不需要选择test="/FCTDocuments/@RSKM-Language = 'FA'">
如果lang属性为FA
,我该如何管理呢?<fo:page-sequence master-reference="ContentSequence" initial-page-number="auto-odd" writing-mode="rl-tb"> <!---->
<xsl:if test="/FCTDocuments/@RSKM-ProductType = 'MM' ">
<xsl:attribute name="initial-page-number">
<xsl:text>1</xsl:text>
</xsl:attribute>
</xsl:if>
答案 1 :(得分:0)
您最初表示您正在寻找合适的XPath来选择您的METADATA /元数据,这就是我要求在源XML中查看语言代码的原因。
我猜这是你想要的:
<xsl:if test="/FCTDocuments/@RSKM-Language = 'FA'">
<xsl:attribute name="writing-mode">rl</xsl:attribute>
</xsl:if>
然后,您可以省略writing-mode
上的fo:page-sequence
属性,因为默认writing-mode
值为lr-tb
。