<xsl:include href="../common/titles.xsl"/>
<xsl:include href="../common/subtitles.xsl"/>
<xsl:include href="../common/gentext.xsl"/>
+<xsl:include href="../common/olink.xsl"/>
+<xsl:include href="../common/targets.xsl"/>
<xsl:include href="../common/pi.xsl"/>
<xsl:include href="autotoc.xsl"/>
<xsl:include href="autoidx.xsl"/>
<xsl:include href="pi.xsl"/>
<xsl:include href="ebnf.xsl"/>
<xsl:include href="docbookng.xsl"/>
+<xsl:include href="../html/chunker.xsl"/>
<xsl:include href="fop.xsl"/>
<xsl:include href="passivetex.xsl"/>
<!-- to documents that don't have one. But not before the whole stylesheet -->
<!-- has been converted to use namespaces. i.e., don't hold your breath -->
<xsl:variable name="nons">
- <xsl:apply-templates mode="stripNS"/>
+ <xsl:apply-templates mode="stripNS"/>
</xsl:variable>
<xsl:apply-templates select="exsl:node-set($nons)"/>
</xsl:when>
<xsl:otherwise>
- <xsl:variable name="document.element" select="*[1]"/>
-
- <xsl:if test="not(contains($root.elements,
- concat(' ', local-name($document.element), ' ')))">
- <xsl:message terminate="yes">
- <xsl:text>ERROR: Document root element for FO output </xsl:text>
- <xsl:text>must be one of the following elements:</xsl:text>
- <xsl:value-of select="$root.elements"/>
- </xsl:message>
- </xsl:if>
+ <xsl:choose>
+ <xsl:when test="$rootid != ''">
+ <xsl:variable name="root.element" select="key('id', $rootid)"/>
+ <xsl:choose>
+ <xsl:when test="count($root.element) = 0">
+ <xsl:message terminate="yes">
+ <xsl:text>ID '</xsl:text>
+ <xsl:value-of select="$rootid"/>
+ <xsl:text>' not found in document.</xsl:text>
+ </xsl:message>
+ </xsl:when>
+ <xsl:when test="not(contains($root.elements, concat(' ', local-name($root.element), ' ')))">
+ <xsl:message terminate="yes">
+ <xsl:text>ERROR: Document root element ($rootid=</xsl:text>
+ <xsl:value-of select="$rootid"/>
+ <xsl:text>) for FO output </xsl:text>
+ <xsl:text>must be one of the following elements:</xsl:text>
+ <xsl:value-of select="$root.elements"/>
+ </xsl:message>
+ </xsl:when>
+ <!-- Otherwise proceed -->
+ <xsl:otherwise>
+ <xsl:if test="$collect.xref.targets = 'yes' or
+ $collect.xref.targets = 'only'">
+ <xsl:apply-templates select="$root.element"
+ mode="collect.targets"/>
+ </xsl:if>
+ <xsl:if test="$collect.xref.targets != 'only'">
+ <xsl:apply-templates select="$root.element"
+ mode="process.root"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- Otherwise process the document root element -->
+ <xsl:otherwise>
+ <xsl:variable name="document.element" select="*[1]"/>
+ <xsl:choose>
+ <xsl:when test="not(contains($root.elements,
+ concat(' ', local-name($document.element), ' ')))">
+ <xsl:message terminate="yes">
+ <xsl:text>ERROR: Document root element for FO output </xsl:text>
+ <xsl:text>must be one of the following elements:</xsl:text>
+ <xsl:value-of select="$root.elements"/>
+ </xsl:message>
+ </xsl:when>
+ <!-- Otherwise proceed -->
+ <xsl:otherwise>
+ <xsl:if test="$collect.xref.targets = 'yes' or
+ $collect.xref.targets = 'only'">
+ <xsl:apply-templates select="/"
+ mode="collect.targets"/>
+ </xsl:if>
+ <xsl:if test="$collect.xref.targets != 'only'">
+ <xsl:apply-templates select="/"
+ mode="process.root"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
- <xsl:call-template name="root.messages"/>
+<xsl:template match="*" mode="process.root">
+ <xsl:variable name="document.element" select="self::*"/>
- <xsl:variable name="title">
- <xsl:choose>
- <xsl:when test="$document.element/title[1]">
- <xsl:value-of select="$document.element/title[1]"/>
- </xsl:when>
- <xsl:otherwise>[could not find document title]</xsl:otherwise>
- </xsl:choose>
+ <xsl:call-template name="root.messages"/>
+
+ <xsl:variable name="title">
+ <xsl:choose>
+ <xsl:when test="$document.element/title[1]">
+ <xsl:value-of select="$document.element/title[1]"/>
+ </xsl:when>
+ <xsl:otherwise>[could not find document title]</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <fo:root xsl:use-attribute-sets="root.properties">
+ <xsl:attribute name="language">
+ <xsl:call-template name="l10n.language">
+ <xsl:with-param name="target" select="/*[1]"/>
+ </xsl:call-template>
+ </xsl:attribute>
+
+ <xsl:if test="$xep.extensions != 0">
+ <xsl:call-template name="xep-document-information"/>
+ </xsl:if>
+ <xsl:if test="$axf.extensions != 0">
+ <xsl:call-template name="axf-document-information"/>
+ </xsl:if>
+
+ <xsl:call-template name="setup.pagemasters"/>
+
+ <xsl:if test="$fop.extensions != 0">
+ <xsl:apply-templates mode="fop.outline"/>
+ </xsl:if>
+ <xsl:if test="$xep.extensions != 0">
+ <xsl:variable name="bookmarks">
+ <xsl:apply-templates mode="xep.outline"/>
</xsl:variable>
-
- <fo:root xsl:use-attribute-sets="root.properties">
- <xsl:attribute name="language">
- <xsl:call-template name="l10n.language">
- <xsl:with-param name="target" select="/*[1]"/>
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:if test="$xep.extensions != 0">
- <xsl:call-template name="xep-document-information"/>
- </xsl:if>
- <xsl:if test="$axf.extensions != 0">
- <xsl:call-template name="axf-document-information"/>
- </xsl:if>
- <xsl:call-template name="setup.pagemasters"/>
- <xsl:choose>
- <xsl:when test="$rootid != ''">
- <xsl:choose>
- <xsl:when test="count(key('id',$rootid)) = 0">
- <xsl:message terminate="yes">
- <xsl:text>ID '</xsl:text>
- <xsl:value-of select="$rootid"/>
- <xsl:text>' not found in document.</xsl:text>
- </xsl:message>
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="$fop.extensions != 0">
- <xsl:apply-templates select="key('id',$rootid)" mode="fop.outline"/>
- </xsl:if>
- <xsl:if test="$xep.extensions != 0">
- <xsl:variable name="bookmarks">
- <xsl:apply-templates select="key('id',$rootid)" mode="xep.outline"/>
- </xsl:variable>
- <xsl:if test="string($bookmarks) != ''">
- <rx:outline xmlns:rx="http://www.renderx.com/XSL/Extensions">
- <xsl:copy-of select="$bookmarks"/>
- </rx:outline>
- </xsl:if>
- </xsl:if>
- <xsl:apply-templates select="key('id',$rootid)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="$fop.extensions != 0">
- <xsl:apply-templates mode="fop.outline"/>
- </xsl:if>
- <xsl:if test="$xep.extensions != 0">
- <xsl:variable name="bookmarks">
- <xsl:apply-templates mode="xep.outline"/>
- </xsl:variable>
- <xsl:if test="string($bookmarks) != ''">
- <rx:outline xmlns:rx="http://www.renderx.com/XSL/Extensions">
- <xsl:copy-of select="$bookmarks"/>
- </rx:outline>
- </xsl:if>
- </xsl:if>
- <xsl:apply-templates/>
- </xsl:otherwise>
- </xsl:choose>
- </fo:root>
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:if test="string($bookmarks) != ''">
+ <rx:outline xmlns:rx="http://www.renderx.com/XSL/Extensions">
+ <xsl:copy-of select="$bookmarks"/>
+ </rx:outline>
+ </xsl:if>
+ </xsl:if>
+ <xsl:apply-templates select="$document.element"/>
+ </fo:root>
</xsl:template>
<xsl:template name="root.messages">
<xsl:choose>
<xsl:when test="namespace-uri(.) = 'http://docbook.org/docbook-ng'">
<xsl:element name="{local-name(.)}">
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates mode="stripNS"/>
+ <xsl:copy-of select="@*"/>
+ <xsl:apply-templates mode="stripNS"/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates mode="stripNS"/>
+ <xsl:copy-of select="@*"/>
+ <xsl:apply-templates mode="stripNS"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
******************************************************************** -->
-<!-- Create keys for quickly looking up olink targets -->
-<xsl:key name="targetdoc-key" match="document" use="@targetdoc" />
-<xsl:key name="targetptr-key" match="div|obj"
- use="concat(ancestor::document/@targetdoc, '/', @targetptr)" />
-
<!-- ==================================================================== -->
<xsl:template match="anchor">
and (contains(@xrefstyle, 'page')
or contains(@xrefstyle, 'Page')))
and ( $insert.xref.page.number = 'yes'
- or $insert.xref.page.number = '1')
+ or $insert.xref.page.number = '1')
or local-name($target) = 'para'">
<fo:basic-link internal-destination="{@linkend}"
xsl:use-attribute-sets="xref.properties">
<xsl:template match="*" mode="xref-to">
<xsl:param name="referrer"/>
<xsl:param name="xrefstyle"/>
+ <xsl:param name="verbose" select="1"/>
+
- <xsl:message>
- <xsl:text>Don't know what gentext to create for xref to: "</xsl:text>
- <xsl:value-of select="name(.)"/>
- <xsl:text>"</xsl:text>
- </xsl:message>
- <xsl:text>???</xsl:text>
+ <xsl:if test="$verbose != 0">
+ <xsl:message>
+ <xsl:text>Don't know what gentext to create for xref to: "</xsl:text>
+ <xsl:value-of select="name(.)"/>
+ <xsl:text>"</xsl:text>
+ </xsl:message>
+ <xsl:text>???</xsl:text>
+ </xsl:if>
</xsl:template>
<xsl:template match="title" mode="xref-to">
mode="xref-to">
<xsl:param name="referrer"/>
<xsl:param name="xrefstyle"/>
+ <xsl:param name="verbose" select="1"/>
<!-- catch-all for things with (possibly optional) titles -->
<xsl:apply-templates select="." mode="object.xref.markup">
<xsl:with-param name="purpose" select="'xref'"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
+ <xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="procedure" mode="xref-to">
<xsl:param name="referrer"/>
<xsl:param name="xrefstyle"/>
+ <xsl:param name="verbose"/>
<xsl:apply-templates select="." mode="object.xref.markup">
<xsl:with-param name="purpose" select="'xref'"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
+ <xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="listitem" mode="xref-to">
<xsl:param name="referrer"/>
<xsl:param name="xrefstyle"/>
+ <xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="." mode="object.xref.markup">
<xsl:with-param name="purpose" select="'xref'"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
+ <xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="qandaset" mode="xref-to">
<xsl:param name="referrer"/>
<xsl:param name="xrefstyle"/>
+ <xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="." mode="object.xref.markup">
<xsl:with-param name="purpose" select="'xref'"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
+ <xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="qandadiv" mode="xref-to">
<xsl:param name="referrer"/>
<xsl:param name="xrefstyle"/>
+ <xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="." mode="object.xref.markup">
<xsl:with-param name="purpose" select="'xref'"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
+ <xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<!-- yes, show the URI -->
<xsl:choose>
<xsl:when test="$ulink.footnotes != 0 and not(ancestor::footnote)">
- <xsl:text> </xsl:text>
+ <xsl:text> </xsl:text>
<fo:footnote>
<xsl:call-template name="ulink.footnote.number"/>
<fo:footnote-body font-family="{$body.fontset}"
</xsl:choose>
</xsl:template>
-
-<xsl:template match="olink">
- <xsl:param name="target.database"
- select="document($target.database.document, /)"/>
+<xsl:template match="olink" name="olink">
+ <xsl:call-template name="anchor"/>
<xsl:variable name="localinfo" select="@localinfo"/>
- <!-- Olink that points to internal id can be a link -->
- <xsl:variable name="linkend">
- <xsl:choose>
- <xsl:when test="@targetdoc and not(@targetptr)" >
- <xsl:message>Olink missing @targetptr attribute value</xsl:message>
- </xsl:when>
- <xsl:when test="not(@targetdoc) and @targetptr" >
- <xsl:message>Olink missing @targetdoc attribute value</xsl:message>
- </xsl:when>
- <xsl:when test="@targetdoc and @targetptr">
- <xsl:if test="$current.docid = @targetdoc">
- <xsl:if test="id(@targetptr)">
- <xsl:value-of select="@targetptr"/>
- </xsl:if>
- </xsl:if>
- </xsl:when>
- </xsl:choose>
- </xsl:variable>
-
<xsl:choose>
- <xsl:when test="$linkend != ''">
- <fo:basic-link internal-destination="{$linkend}"
- xsl:use-attribute-sets="xref.properties">
- <xsl:call-template name="olink.hottext">
+ <!-- olinks resolved by stylesheet and target database -->
+ <xsl:when test="@targetdoc or @targetptr" >
+ <xsl:variable name="targetdoc.att" select="@targetdoc"/>
+ <xsl:variable name="targetptr.att" select="@targetptr"/>
+
+ <xsl:variable name="olink.lang">
+ <xsl:call-template name="l10n.language">
+ <xsl:with-param name="xref-context" select="true()"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="target.database.filename">
+ <xsl:call-template name="select.target.database">
+ <xsl:with-param name="targetdoc.att" select="$targetdoc.att"/>
+ <xsl:with-param name="targetptr.att" select="$targetptr.att"/>
+ <xsl:with-param name="olink.lang" select="$olink.lang"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="target.database"
+ select="document($target.database.filename, /)"/>
+
+ <xsl:if test="$olink.debug != 0">
+ <xsl:message>
+ <xsl:text>Olink debug: root element of target.database is '</xsl:text>
+ <xsl:value-of select="local-name($target.database/*[1])"/>
+ <xsl:text>'.</xsl:text>
+ </xsl:message>
+ </xsl:if>
+
+ <xsl:variable name="olink.key">
+ <xsl:call-template name="select.olink.key">
+ <xsl:with-param name="targetdoc.att" select="$targetdoc.att"/>
+ <xsl:with-param name="targetptr.att" select="$targetptr.att"/>
+ <xsl:with-param name="olink.lang" select="$olink.lang"/>
<xsl:with-param name="target.database" select="$target.database"/>
</xsl:call-template>
- </fo:basic-link>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="olink.hottext">
- <xsl:with-param name="target.database" select="$target.database"/>
- </xsl:call-template>
-
- <!-- Append other document title if appropriate -->
- <xsl:if test="@targetdoc and @targetptr and $olink.doctitle != 0
- and $current.docid != '' and $current.docid != @targetdoc">
- <xsl:variable name="doctitle">
- <xsl:variable name="seek.targetdoc" select="@targetdoc"/>
- <xsl:for-each select="$target.database" >
- <xsl:value-of select="key('targetdoc-key', $seek.targetdoc)/div[1]/ttl" />
- </xsl:for-each>
- </xsl:variable>
- <xsl:if test="$doctitle != ''">
- <xsl:text> (</xsl:text><xsl:value-of select="$doctitle"/><xsl:text>)</xsl:text>
- </xsl:if>
+ </xsl:variable>
+
+ <xsl:if test="string-length($olink.key) = 0">
+ <xsl:message>
+ <xsl:text>Error: unresolved olink: </xsl:text>
+ <xsl:text>targetdoc/targetptr = '</xsl:text>
+ <xsl:value-of select="$targetdoc.att"/>
+ <xsl:text>/</xsl:text>
+ <xsl:value-of select="$targetptr.att"/>
+ <xsl:text>'.</xsl:text>
+ </xsl:message>
</xsl:if>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
+ <xsl:variable name="href">
+ <xsl:call-template name="make.olink.href">
+ <xsl:with-param name="olink.key" select="$olink.key"/>
+ <xsl:with-param name="target.database" select="$target.database"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <!-- Olink that points to internal id can be a link -->
+ <xsl:variable name="linkend">
+ <xsl:call-template name="olink.as.linkend">
+ <xsl:with-param name="olink.key" select="$olink.key"/>
+ <xsl:with-param name="olink.lang" select="$olink.lang"/>
+ <xsl:with-param name="target.database" select="$target.database"/>
+ </xsl:call-template>
+ </xsl:variable>
-<xsl:template name="olink.hottext">
- <xsl:param name="target.database"/>
+ <xsl:variable name="hottext">
+ <xsl:call-template name="olink.hottext">
+ <xsl:with-param name="olink.key" select="$olink.key"/>
+ <xsl:with-param name="olink.lang" select="$olink.lang"/>
+ <xsl:with-param name="target.database" select="$target.database"/>
+ </xsl:call-template>
+ </xsl:variable>
- <xsl:choose>
- <!-- If it has elements or text (not just PI or comment) -->
- <xsl:when test="child::text() or child::*">
- <xsl:apply-templates/>
- </xsl:when>
- <xsl:when test="@targetdoc and @targetptr">
- <!-- Get the xref text for this record -->
- <xsl:variable name="seek.targetdoc" select="@targetdoc"/>
- <xsl:variable name="seek.targetptr" select="@targetptr"/>
- <xsl:variable name="xref.text" >
- <xsl:for-each select="$target.database" >
- <xsl:value-of select="key('targetptr-key', concat($seek.targetdoc, '/', $seek.targetptr))/xreftext"/>
- </xsl:for-each>
+ <xsl:variable name="olink.docname.citation">
+ <xsl:call-template name="olink.document.citation">
+ <xsl:with-param name="olink.key" select="$olink.key"/>
+ <xsl:with-param name="target.database" select="$target.database"/>
+ <xsl:with-param name="olink.lang" select="$olink.lang"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="olink.page.citation">
+ <xsl:call-template name="olink.page.citation">
+ <xsl:with-param name="olink.key" select="$olink.key"/>
+ <xsl:with-param name="target.database" select="$target.database"/>
+ <xsl:with-param name="olink.lang" select="$olink.lang"/>
+ <xsl:with-param name="linkend" select="$linkend"/>
+ </xsl:call-template>
</xsl:variable>
<xsl:choose>
- <xsl:when test="$use.local.olink.style != 0">
- <!-- Get the element name and lang for this targetptr -->
- <xsl:variable name="element" >
- <xsl:for-each select="$target.database" >
- <xsl:value-of select="key('targetptr-key', concat($seek.targetdoc, '/', $seek.targetptr))/@element"/>
- </xsl:for-each>
- </xsl:variable>
-
- <xsl:variable name="lang">
- <xsl:variable name="candidate">
- <xsl:for-each select="$target.database" >
- <xsl:value-of select="key('targetptr-key', concat($seek.targetdoc, '/', $seek.targetptr))/@lang"/>
- </xsl:for-each>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$candidate != ''">
- <xsl:value-of select="$candidate"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="'en'"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="template">
- <xsl:call-template name="gentext.template">
- <xsl:with-param name="context" select="'title'"/>
- <xsl:with-param name="name" select="$element"/>
- <xsl:with-param name="lang" select="$lang"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:call-template name="substitute-markup">
- <xsl:with-param name="template" select="$template"/>
- <xsl:with-param name="title">
- <xsl:for-each select="$target.database" >
- <xsl:value-of select="key('targetptr-key', concat($seek.targetdoc, '/', $seek.targetptr))/ttl"/>
- </xsl:for-each>
- </xsl:with-param>
- <xsl:with-param name="label">
- <xsl:for-each select="$target.database" >
- <xsl:value-of select="key('targetptr-key', concat($seek.targetdoc, '/', $seek.targetptr))/@number"/>
- </xsl:for-each>
- </xsl:with-param>
- </xsl:call-template>
+ <xsl:when test="$linkend != ''">
+ <fo:basic-link internal-destination="{$linkend}"
+ xsl:use-attribute-sets="xref.properties">
+ <xsl:copy-of select="$hottext"/>
+ <xsl:copy-of select="$olink.page.citation"/>
+ </fo:basic-link>
</xsl:when>
- <xsl:when test="$xref.text !=''">
- <xsl:value-of select="$xref.text"/>
+ <xsl:when test="$href != ''">
+ <xsl:choose>
+ <xsl:when test="$xep.extensions != 0">
+ <fo:basic-link external-destination="url({$href})"
+ xsl:use-attribute-sets="olink.properties">
+ <xsl:copy-of select="$hottext"/>
+ </fo:basic-link>
+ <xsl:copy-of select="$olink.page.citation"/>
+ <xsl:copy-of select="$olink.docname.citation"/>
+ </xsl:when>
+ <xsl:when test="$axf.extensions != 0">
+ <fo:basic-link external-destination="{$href}"
+ xsl:use-attribute-sets="xref.properties"
+ show-destination="replace">
+ <xsl:copy-of select="$hottext"/>
+ </fo:basic-link>
+ <xsl:copy-of select="$olink.page.citation"/>
+ <xsl:copy-of select="$olink.docname.citation"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <fo:basic-link external-destination="{$href}"
+ xsl:use-attribute-sets="xref.properties"
+ show-destination="replace">
+ <xsl:copy-of select="$hottext"/>
+ </fo:basic-link>
+ <xsl:copy-of select="$olink.page.citation"/>
+ <xsl:copy-of select="$olink.docname.citation"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:when>
<xsl:otherwise>
- <xsl:message>Olink error: no generated text for targetdoc/targetptr = <xsl:value-of select="@targetdoc"/>/<xsl:value-of select="@targetptr"/></xsl:message>
- <xsl:text>????</xsl:text>
+ <xsl:copy-of select="$hottext"/>
+ <xsl:copy-of select="$olink.page.citation"/>
+ <xsl:copy-of select="$olink.docname.citation"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
+
+ <!-- olink never implemented in FO for old olink entity syntax -->
<xsl:otherwise>
- <xsl:text>????</xsl:text>
-<!--
- <xsl:call-template name="olink.outline">
- <xsl:with-param name="outline.base.uri"
- select="unparsed-entity-uri(@targetdocent)"/>
- <xsl:with-param name="localinfo" select="@localinfo"/>
- <xsl:with-param name="return" select="'xreftext'"/>
- </xsl:call-template>
--->
+ <xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
+<xsl:template match="*" mode="insert.olink.docname.markup">
+ <xsl:param name="docname" select="''"/>
+
+ <fo:inline font-style="italic">
+ <xsl:value-of select="$docname"/>
+ </fo:inline>
+
+</xsl:template>
+
+<!-- This prevents error message when processing olinks with xrefstyle -->
+<xsl:template match="olink" mode="object.xref.template"/>
+
+
+<xsl:template name="olink.as.linkend">
+ <xsl:param name="olink.key" select="''"/>
+ <xsl:param name="olink.lang" select="''"/>
+ <xsl:param name="target.database" select="NotANode"/>
+
+ <xsl:variable name="targetdoc">
+ <xsl:value-of select="substring-before($olink.key, '/')"/>
+ </xsl:variable>
+
+ <xsl:variable name="targetptr">
+ <xsl:value-of
+ select="substring-before(substring-after($olink.key, '/'), '/')"/>
+ </xsl:variable>
+
+ <xsl:variable name="target.lang">
+ <xsl:variable name="candidate">
+ <xsl:for-each select="$target.database" >
+ <xsl:value-of
+ select="key('targetptr-key', $olink.key)/@lang" />
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$candidate != ''">
+ <xsl:value-of select="$candidate"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$olink.lang"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:if test="$current.docid = $targetdoc and
+ $olink.lang = $target.lang">
+ <xsl:variable name="targets" select="key('id',$targetptr)"/>
+ <xsl:variable name="target" select="$targets[1]"/>
+ <xsl:if test="$target">
+ <xsl:value-of select="$targetptr"/>
+ </xsl:if>
+ </xsl:if>
+
+</xsl:template>
+
+
<xsl:template name="olink.outline">
<xsl:message terminate="yes">Fatal error: what is this supposed to do?</xsl:message>
</xsl:template>