Xsl-fo 从 xml 访问属性值并应用 fo 内联转换
Xsl-fo accessing attribute value from xml and applying fo inline transformation
我试图通过访问 xml 文件的属性值来应用样式,请参考下面的示例 xml 并建议使用 xsl,
比如元素的属性值是粗体,则必须是粗体样式。请帮忙。
<main>
<reference>
<p>This is bold attribute <style type="bold">Sample 1</style></p>
<p>This is italic attribute <style type="italic">Sample 1</style></p>
</reference>
</main>
您需要将样式信息转换为可用于 FO 格式的内容:
<xsl:template match="style">
<fo:inline>
<xsl:choose>
<xsl:when test="@type='bold'">
<xsl:attribute name="font-weight">bold</xsl:attribute>
</xsl:when>
<xsl:when test="@type='italic'">
<xsl:attribute name="font-style">italic</xsl:attribute>
等
我试图通过访问 xml 文件的属性值来应用样式,请参考下面的示例 xml 并建议使用 xsl,
比如元素的属性值是粗体,则必须是粗体样式。请帮忙。
<main>
<reference>
<p>This is bold attribute <style type="bold">Sample 1</style></p>
<p>This is italic attribute <style type="italic">Sample 1</style></p>
</reference>
</main>
您需要将样式信息转换为可用于 FO 格式的内容:
<xsl:template match="style">
<fo:inline>
<xsl:choose>
<xsl:when test="@type='bold'">
<xsl:attribute name="font-weight">bold</xsl:attribute>
</xsl:when>
<xsl:when test="@type='italic'">
<xsl:attribute name="font-style">italic</xsl:attribute>
等