I am trying to modify an stylesheet so that if will handle 3 different types of internal links in a pdf document. The pdf document is made up of several smaller documents.
here are excerpts from the xml:
<!--links to para within document-->
<xref xidtype="para" xrefid="par-0001">A</xref>
<!--links to another document-->
<xref xidtype="other" xlink:href="docname">A</xref>
<!--links to para within another document-->
<xref xidtype="other" xlink:href="docname#par-0001">A</xref>
I know the following xsl works for linking from one document to another:
<xsl:template match="xref" mode="PageBody">
<fo:basic-link internal-destination="{concat(@xlink:href,'_page')}">
<xsl:value-of select="."/>
</fo:basic-link>
</xsl:template>
Here's my xsl attempt to address all 3 types of internal links, it doesn't work:
<xsl:template match="xref" mode="PageBody">
<xsl:variable name="link">
<xsl:if test="contains(@xlink:href,'#')">
<xsl:value-of select="replace(@xlink:href,'#','_')"/>
</xsl:if>
<xsl:if test="not(contains(@xlink:href,'#'))">
<xsl:value-of select="@xlink:href"/>
</xsl:if>
</xsl:variable>
<xsl:if test="@xlink:href">
<fo:basic-link internal-destination="{concat($link,'_page')}">
<xsl:value-of select="."/>
</fo:basic-link>
</xsl:if>
<xsl:if test="@xrefid">
<fo:basic-link internal-destination="{concat($module-code,'_',@xrefid)}">
<xsl:value-of select="."/>
</fo:basic-link>
</xsl:if>
</xsl:template>
appreciate any help.
here are excerpts from the xml:
<!--links to para within document-->
<xref xidtype="para" xrefid="par-0001">A</xref>
<!--links to another document-->
<xref xidtype="other" xlink:href="docname">A</xref>
<!--links to para within another document-->
<xref xidtype="other" xlink:href="docname#par-0001">A</xref>
I know the following xsl works for linking from one document to another:
<xsl:template match="xref" mode="PageBody">
<fo:basic-link internal-destination="{concat(@xlink:href,'_page')}">
<xsl:value-of select="."/>
</fo:basic-link>
</xsl:template>
Here's my xsl attempt to address all 3 types of internal links, it doesn't work:
<xsl:template match="xref" mode="PageBody">
<xsl:variable name="link">
<xsl:if test="contains(@xlink:href,'#')">
<xsl:value-of select="replace(@xlink:href,'#','_')"/>
</xsl:if>
<xsl:if test="not(contains(@xlink:href,'#'))">
<xsl:value-of select="@xlink:href"/>
</xsl:if>
</xsl:variable>
<xsl:if test="@xlink:href">
<fo:basic-link internal-destination="{concat($link,'_page')}">
<xsl:value-of select="."/>
</fo:basic-link>
</xsl:if>
<xsl:if test="@xrefid">
<fo:basic-link internal-destination="{concat($module-code,'_',@xrefid)}">
<xsl:value-of select="."/>
</fo:basic-link>
</xsl:if>
</xsl:template>
appreciate any help.