我想显示属性值和相应元素值之间的差异。所以我只需要使用氧气将dita中的属性值加粗为pdf。我为此尝试了xsl,但它不起作用:
我的输入dita xml文件是:
<data-about>
<data type="data.module.code">HSXWB-A-79-11-11-00A01-000A-D</data>
<data type="classification">01</data>
<data type="responsible.partner.company">F0302</data>
<data type="originator">F0302</data>
<data type="applicability">ALL</data>
<data type="data.module.reference.code">TRENTXWB-A-00-00-00-01A01-022A-D</data>
<data type="quality.assurance">tabtop</data>
<data type="skill.level">sk01</data>
<data type="reason.for.update">First Release</data>
<data type="publication.code">UNKNOWN PUBLICATION</data>
</data-about>
我的xsl(2.0)用作:
<xsl:template match="/">
<fo:block xsl:use-attribute-sets="data">
<xsl:apply-templates select="//data-about"/>
</fo:block>
</xsl:template>
<xsl:template match="data-about/*">
<fo:block xsl:use-attribute-sets="data">
<xsl:value-of select="concat(@type, ' : ', current())"/>
</fo:block>
</xsl:template>
现在我的输出
data.module.code:HSXWB-A-79-11-11-00A01-000A-D
分类:01
responsible.partner.company:F0302
我希望pdf输出为
data.module.code :HSXWB-A-79-11-11-00A01-000A-D
分类:01
responsible.partner.company :F0302
。
请指导一下。提前致谢
答案 0 :(得分:1)
要实现粗体样式,您必须使用<fo:inline>
:
<fo:inline font-weight="bold">
<xsl:apply-templates select="node()"/>
</fo:inline>
对于你的例子:
<xsl:template match="data-about/*">
<fo:block xsl:use-attribute-sets="data">
<fo:inline font-weight="bold">
<xsl:value-of select="@type"/>
</fo:inline>
<xsl:value-of select="concat(' : ', current())"/>
</fo:block>
</xsl:template>