XSL-FO List
Posted: Fri May 21, 2010 4:56 pm
I am having problem creating a “List, internal link, external link, subscript and supscript” templates for my XSL-FO file to render my xml file to PDF. The xml documents are tagged this way.
For List
<list type=”bulleted”>
<item>Some Text</item>
</list>
For External Link (<extlink fileref="http://test.org">Text</extlink>) and
For Internal Links (<link idref="appB">appendix B</link>)
For subscripts and superscripts (<supscrpt></supscrpt>) and (<subscrpt></subscript>)
The xsl-fo file that I have created looks like this,
<xsl:template match="list">
<xsl:if test="@type='bulleted'">
<fo:list-block provisional-distance-between-starts="18pt"
provisional-label-separation="3pt">
<fo:list-item-label end-indent="label-end()">
<fo:block>•</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()">
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:list-item-body>
</fo:list-block>
</xsl:if-->
</xsl:template>
<xsl:template match="link">
<fo:basic-link role="internal link" color="blue" text-decoration="underline">
<xsl:attribute name="internal-destination">
<xsl:value-of select="@idref"/>
</xsl:attribute>
<xsl:apply-templates/>
</fo:basic-link>
</xsl:template>
<xsl:template match="extlink">
<fo:basic-link show-destination="new" role="external link" color="blue"
text-decoration="underline">
<xsl:attribute name="external-destination">
<xsl:value-of select="@fileref"/>
</xsl:attribute>
</fo:basic-link>
</xsl:template>
<xsl:template match="supscrpt">
<fo:inline font-size="smaller" baseline-shift="super">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<xsl:template match="subscrpt">
<xsl:if test="subscrpt">
<fo:inline font-size="5pt" baseline-shift="sub">
<xsl:apply-templates/>
</fo:inline>
</xsl:if>
</xsl:template>
Please help
For List
<list type=”bulleted”>
<item>Some Text</item>
</list>
For External Link (<extlink fileref="http://test.org">Text</extlink>) and
For Internal Links (<link idref="appB">appendix B</link>)
For subscripts and superscripts (<supscrpt></supscrpt>) and (<subscrpt></subscript>)
The xsl-fo file that I have created looks like this,
<xsl:template match="list">
<xsl:if test="@type='bulleted'">
<fo:list-block provisional-distance-between-starts="18pt"
provisional-label-separation="3pt">
<fo:list-item-label end-indent="label-end()">
<fo:block>•</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()">
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:list-item-body>
</fo:list-block>
</xsl:if-->
</xsl:template>
<xsl:template match="link">
<fo:basic-link role="internal link" color="blue" text-decoration="underline">
<xsl:attribute name="internal-destination">
<xsl:value-of select="@idref"/>
</xsl:attribute>
<xsl:apply-templates/>
</fo:basic-link>
</xsl:template>
<xsl:template match="extlink">
<fo:basic-link show-destination="new" role="external link" color="blue"
text-decoration="underline">
<xsl:attribute name="external-destination">
<xsl:value-of select="@fileref"/>
</xsl:attribute>
</fo:basic-link>
</xsl:template>
<xsl:template match="supscrpt">
<fo:inline font-size="smaller" baseline-shift="super">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<xsl:template match="subscrpt">
<xsl:if test="subscrpt">
<fo:inline font-size="5pt" baseline-shift="sub">
<xsl:apply-templates/>
</fo:inline>
</xsl:if>
</xsl:template>
Please help