How to match <sup>value</sup> in XSL-FO

那年仲夏 提交于 2020-03-06 04:09:51

问题


I'm using xsl-fo and trying to style xref content within a <sup>

eg I want to make the 2 superscript.

<sup id="FNB-0002"><xref href="#Comp_CLJONLINE_CLJ_2010_04_2/FN-0002">2</xref></sup>

I am using the following code which I think should work.

 <xsl:template match="sup[@id='*']">    
        <fo:inline font-size="24pt" font-weight="bold" text-indent="2em" text-transform="uppercase" >
            <xsl:apply-templates/>
            </fo:inline>
    </xsl:template>

But none of the styles I am applying are being recognised. I'm beginning to think that this is because the 2 is within an xref and the xsl-fo is then ignoring it.

Could anyone give me some pointers as how to cater for and style these sups

Thanks,


回答1:


The reason this template is not matching your <sup> element is because you are matching a <sup> with an id attribute that has the value *.

If you are trying to match <sup> elements that have an id attribute, change your match to this:

sup[@id]

Also, try using vertical-align="super" for superscript text.

Example:

<fo:inline vertical-align="super" font-size="8pt">
    <xsl:apply-templates/>
</fo:inline>


来源:https://stackoverflow.com/questions/5718411/how-to-match-supvalue-sup-in-xsl-fo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!