| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- This file is part of the DITA Open Toolkit project.
- See the accompanying license.txt file for applicable licenses. -->
- <!-- (c) Copyright IBM Corp. 2005, 2006 All Rights Reserved. -->
- <xsl:stylesheet
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
- xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
- xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
- xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
- xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
- xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
- xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
- xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"
- xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
- xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
- xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
- xmlns:math="http://www.w3.org/1998/Math/MathML"
- xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
- xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
- xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0"
- xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0"
- xmlns:prodtools="http://www.ibm.com/xmlns/prodtools"
- xmlns:dita-ot="http://dita-ot.sourceforge.net/ns/201007/dita-ot"
- xmlns:opentopic-mapmerge="http://www.idiominc.com/opentopic/mapmerge"
- xmlns:opentopic-func="http://www.idiominc.com/opentopic/exsl/function"
- exclude-result-prefixes="opentopic-mapmerge opentopic-func dita-ot"
- version="2.0">
-
- <xsl:import href="plugin:org.dita.base:xsl/common/output-message.xsl"/>
- <xsl:variable name="msgprefix">DOTX</xsl:variable>
- <!--
- <xsl:include href="../../cfg/fo/attrs/links-attr.xsl"/>
- -->
-
- <xsl:param name="chapterLayout" select="''"/>
- <xsl:key name="key_anchor" match="*[@id][not(contains(@class,' map/topicref '))]" use="@id"/>
- <!--[not(contains(@class,' map/topicref '))]-->
- <xsl:template name="insertLinkShortDesc">
- <xsl:param name="destination"/>
- <xsl:param name="element"/>
- <xsl:param name="linkScope"/>
- <xsl:choose>
- <!-- User specified description (from map or topic): use that. -->
- <xsl:when test="*[contains(@class,' topic/desc ')] and processing-instruction()[name()='ditaot'][.='usershortdesc']">
- <text:p text:style-name="Default_20_Text">
- <xsl:apply-templates select="*[contains(@class, ' topic/desc ')]"/>
- </text:p>
- </xsl:when>
- <!-- External: do not attempt to retrieve. -->
- <xsl:when test="$linkScope='external'">
- </xsl:when>
- <!-- When the target has a short description and no local override, use the target -->
- <xsl:when test="$element/*[contains(@class, ' topic/shortdesc ')]">
- <text:line-break/>
- <text:tab/>
- <xsl:apply-templates select="$element/*[contains(@class, ' topic/shortdesc ')]" mode="dita-ot:text-only"/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="insertLinkDesc">
- <text:line-break>
- <text:tab>
- <xsl:apply-templates select="*[contains(@class,' topic/desc ')]" mode="insert-description"/>
- </text:tab>
- </text:line-break>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/xref ') or contains(@class, ' topic/link ')]/*[contains(@class,' topic/desc ')]" priority="1"/>
- <xsl:template match="*[contains(@class,' topic/desc ')]" mode="insert-description">
- <xsl:apply-templates/>
- </xsl:template>
- <!-- The insertReferenceTitle template is called from <xref> and <link> and is
- used to build link contents (using full FO syntax, not just the text). -->
- <xsl:template name="insertReferenceTitle">
- <xsl:param name="href"/>
- <xsl:param name="titlePrefix"/>
- <xsl:param name="destination"/>
- <xsl:param name="element"/>
- <xsl:apply-templates select="." mode="insertReferenceTitle">
- <xsl:with-param name="href" select="$href"/>
- <xsl:with-param name="titlePrefix" select="$titlePrefix"/>
- <xsl:with-param name="destination" select="$destination"/>
- <xsl:with-param name="element" select="$element"/>
- </xsl:apply-templates>
- </xsl:template>
- <!-- Process any cross reference or link with author-specified text.
- The specified text is used as the link text. Added by RDA for
- SourceForge bug 1880097. -->
- <xsl:template match="*[processing-instruction()[name()='ditaot'][.='usertext']]" mode="insertReferenceTitle">
- <xsl:apply-templates select="*[not(contains(@class,' topic/desc '))]|text()"/>
- </xsl:template>
- <!-- Process any cross reference or link with no content, or with content
- generated by the DITA-OT preprocess. The title will be retrieved from
- the target element, and combined with generated text such as Figure N. -->
- <xsl:template match="*" mode="insertReferenceTitle">
- <xsl:param name="href"/>
- <xsl:param name="titlePrefix"/>
- <xsl:param name="destination"/>
- <xsl:param name="element"/>
- <xsl:variable name="referenceContent">
- <xsl:choose>
- <xsl:when test="not($element) or ($destination = '')">
- <xsl:text>#none#</xsl:text>
- </xsl:when>
- <xsl:when test="contains($element/@class,' topic/li ') and contains($element/parent::*/@class,' topic/ol ')">
- <!-- SF Bug 1839827: This causes preprocessor text to be used for links to OL/LI -->
- <xsl:text>#none#</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="$element" mode="retrieveReferenceTitle"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:if test="not($titlePrefix = '')">
- <!--
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="$titlePrefix"/>
- </xsl:call-template>
- -->
- </xsl:if>
- <xsl:choose>
- <xsl:when test="not($element) or ($destination = '') or $referenceContent='#none#'">
- <xsl:choose>
- <xsl:when test="*[not(contains(@class,' topic/desc '))] | text()">
- <xsl:apply-templates select="*[not(contains(@class,' topic/desc '))] | text()"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$href"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of select="$referenceContent"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="*[contains(@class, ' topic/fig ')][*[contains(@class, ' topic/title ')]]" mode="retrieveReferenceTitle">
- <!--
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Figure'"/>
- <xsl:with-param name="params">
- <text:span>
- <xsl:value-of select="count(preceding::*[contains(@class, ' topic/fig ')][child::*[contains(@class, ' topic/title ')]]) + 1"/>
- </text:span>
- <text:h>
- <xsl:apply-templates select="*[contains(@class, ' topic/title ')]" mode="insert-text"/>
- </text:h>
- </xsl:with-param>
- </xsl:call-template>
- -->
-
- <text:span>
- <xsl:value-of select="count(preceding::*[contains(@class, ' topic/fig ')][child::*[contains(@class, ' topic/title ')]]) + 1"/>
- </text:span>
- <text:h>
- <xsl:apply-templates select="*[contains(@class, ' topic/title ')]" mode="insert-text"/>
- </text:h>
- </xsl:template>
- <xsl:template match="*[contains(@class, ' topic/section ')][*[contains(@class, ' topic/title ')]]" mode="retrieveReferenceTitle">
- <xsl:variable name="title">
- <xsl:apply-templates select="*[contains(@class, ' topic/title ')]" mode="insert-text"/>
- </xsl:variable>
- <xsl:value-of select="normalize-space($title)"/>
- </xsl:template>
- <xsl:template match="*[contains(@class, ' topic/table ')][*[contains(@class, ' topic/title ')]]" mode="retrieveReferenceTitle">
- <!--
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Table'"/>
- <xsl:with-param name="params">
- <text:span>
- <xsl:value-of select="count(preceding::*[contains(@class, ' topic/table ')][child::*[contains(@class, ' topic/title ')]]) + 1"/>
- </text:span>
- <text:h>
- <xsl:apply-templates select="*[contains(@class, ' topic/title ')]" mode="insert-text"/>
- </text:h>
- </xsl:with-param>
- </xsl:call-template>
- -->
- <text:span>
- <xsl:value-of select="count(preceding::*[contains(@class, ' topic/table ')][child::*[contains(@class, ' topic/title ')]]) + 1"/>
- </text:span>
- <text:h>
- <xsl:apply-templates select="*[contains(@class, ' topic/title ')]" mode="insert-text"/>
- </text:h>
- </xsl:template>
- <xsl:template match="*[contains(@class, ' topic/li ')]" mode="retrieveReferenceTitle">
- <!--
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'List item'"/>
- </xsl:call-template>
- -->
- <text:p text:style-name="Default_20_Text">
- <text:span text:style-name="bold">
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'List item'"/>
- </xsl:call-template>
- </text:span>
- </text:p>
-
-
- </xsl:template>
- <xsl:template match="*[contains(@class, ' topic/fn ')]" mode="retrieveReferenceTitle">
- <!--
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Foot note'"/>
- </xsl:call-template>
- -->
- <text:p text:style-name="Default_20_Text">
- <text:span text:style-name="bold">
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Foot note'"/>
- </xsl:call-template>
- </text:span>
- </text:p>
- </xsl:template>
- <!-- Default rule: if element has a title, use that, otherwise return '#none#' -->
- <xsl:template match="*" mode="retrieveReferenceTitle">
- <xsl:choose>
- <xsl:when test="*[contains(@class,' topic/title ')]">
- <xsl:value-of select="string(*[contains(@class, ' topic/title ')])"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>#none#</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/xref ')]">
- <xsl:variable name="destination" select="opentopic-func:getDestinationId(@href)"/>
- <xsl:variable name="element" select="key('key_anchor',$destination)[1]"/>
- <xsl:variable name="referenceTitle">
- <xsl:call-template name="insertReferenceTitle">
- <xsl:with-param name="href" select="@href"/>
- <xsl:with-param name="titlePrefix" select="''"/>
- <xsl:with-param name="destination" select="$destination"/>
- <xsl:with-param name="element" select="$element"/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:if test="parent::*[contains(@class,' topic/li ')]">
- <xsl:text disable-output-escaping="yes"><text:p></xsl:text>
- </xsl:if>
- <text:a>
- <xsl:call-template name="buildBasicLinkDestination">
- <xsl:with-param name="scope" select="@scope"/>
- <xsl:with-param name="href" select="@href"/>
- </xsl:call-template>
- <xsl:choose>
- <xsl:when test="not(@scope = 'external') and not($referenceTitle = '')">
- <xsl:copy-of select="$referenceTitle"/>
- </xsl:when>
- <xsl:when test="not(@scope = 'external')">
- <xsl:call-template name="insertPageNumberCitation">
- <xsl:with-param name="isTitleEmpty" select="'yes'"/>
- <xsl:with-param name="destination" select="$destination"/>
- <xsl:with-param name="element" select="$element"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="*[not(contains(@class,' topic/desc '))] | text()">
- <xsl:apply-templates select="*[not(contains(@class,' topic/desc '))] | text()"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@href"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </text:a>
- <!--
- Disable because of the CQ#8102 bug
- <xsl:if test="*[contains(@class,' topic/desc ')]">
- <xsl:call-template name="insertLinkDesc"/>
- </xsl:if>
- -->
- <xsl:if test="not(@scope = 'external') and not($referenceTitle = '') and not($element[contains(@class, ' topic/fn ')])">
- <!-- SourceForge bug 1880097: should not include page number when xref includes author specified text -->
- <xsl:if test="not(processing-instruction()[name()='ditaot'][.='usertext'])">
- <xsl:call-template name="insertPageNumberCitation">
- <xsl:with-param name="destination" select="$destination"/>
- <xsl:with-param name="element" select="$element"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:if>
-
- <xsl:if test="parent::*[contains(@class,' topic/li ')]">
- <xsl:text disable-output-escaping="yes"></text:p></xsl:text>
- </xsl:if>
- </xsl:template>
- <!-- xref to footnote makes a callout. -->
- <xsl:template match="*[contains(@class,' topic/xref ')][@type='fn']" priority="2">
- <xsl:variable name="href-fragment" select="substring-after(@href, '#')"/>
- <xsl:variable name="footnote-target" select="//*[contains(@class, ' topic/fn ')][@id = substring-after($href-fragment, '/')][ancestor::*[contains(@class, ' topic/topic ')][1]/@id = substring-before($href-fragment, '/')]"/>
- <xsl:apply-templates select="$footnote-target" mode="footnote-callout"/>
- </xsl:template>
- <xsl:template match="*[contains(@class, ' topic/fn ')]" mode="footnote-callout">
- <text:tab/>
- <xsl:choose>
- <xsl:when test="@callout">
- <xsl:value-of select="@callout"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:number level="any" count="*[contains(@class,' topic/fn ') and not(@callout)]"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/related-links ')]">
- <xsl:if test="normalize-space($includeRelatedLinkRoles)">
- <xsl:variable name="topicType">
- <xsl:for-each select="parent::*">
- <xsl:call-template name="determineTopicType"/>
- </xsl:for-each>
- </xsl:variable>
- <xsl:variable name="collectedLinks">
- <xsl:apply-templates mode="processLink">
- <xsl:with-param name="topicType" select="$topicType"/>
- </xsl:apply-templates>
- </xsl:variable>
- <xsl:variable name="linkTextContent" select="$collectedLinks"/>
- <xsl:if test="normalize-space($linkTextContent)!=''">
- <text:p text:style-name="Default_20_Text">
- <!--
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Related Links'"/>
- </xsl:call-template>
- -->
- <text:span text:style-name="bold">
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Related Links'"/>
- </xsl:call-template>
- </text:span>
- <!--
- <text:line-break/>
- <text:tab/>
- -->
- <!--
- <xsl:copy-of select="$collectedLinks"/>
- -->
- <!--
- <xsl:value-of select="$collectedLinks" disable-output-escaping="yes"/>
- -->
- <xsl:apply-templates mode="processLink">
- <xsl:with-param name="topicType" select="$topicType"/>
- </xsl:apply-templates>
- </text:p>
- </xsl:if>
- </xsl:if>
- </xsl:template>
- <xsl:template name="getLinkScope">
- <xsl:choose>
- <xsl:when test="@scope">
- <xsl:value-of select="@scope"/>
- </xsl:when>
- <xsl:when test="contains(@class, ' topic/related-links ')">
- <xsl:value-of select="'local'"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:for-each select="..">
- <xsl:call-template name="getLinkScope"/>
- </xsl:for-each>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!-- 20100323: Update to be aware of new includeRelatedLinks parameter.
- Move main processing of link into a mode template; this allows customized
- code to easily match links without the need to copy processing logic. -->
- <xsl:template match="*[contains(@class,' topic/link ')]" mode="processLink">
- <xsl:param name="topicType">
- <xsl:for-each select="ancestor::*[contains(@class,' topic/topic ')][1]">
- <xsl:call-template name="determineTopicType"/>
- </xsl:for-each>
- </xsl:param>
- <xsl:choose>
- <xsl:when test="(@role and not(contains($includeRelatedLinkRoles, concat(' ', @role, ' ')))) or (not(@role) and not(contains($includeRelatedLinkRoles, ' #default ')))"/>
- <xsl:when test="@role='child' and $chapterLayout='MINITOC' and ($topicType='topicChapter' or $topicType='topicAppendix' or $topicType='topicPart')">
- <!-- When a minitoc already links to children, do not add them here -->
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="." mode="processLinks"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/link ')]" mode="processLinks">
- <xsl:variable name="destination" select="opentopic-func:getDestinationId(@href)"/>
- <xsl:variable name="element" select="key('key_anchor',$destination)[1]"/>
- <xsl:variable name="referenceTitle">
- <xsl:call-template name="insertReferenceTitle">
- <xsl:with-param name="href" select="@href"/>
- <xsl:with-param name="titlePrefix" select="''"/>
- <xsl:with-param name="destination" select="$destination"/>
- <xsl:with-param name="element" select="$element"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="linkScope">
- <xsl:call-template name="getLinkScope"/>
- </xsl:variable>
- <!--<xsl:text>• </xsl:text>-->
- <text:line-break/>
- <text:tab/>
- <text:a>
- <xsl:call-template name="buildBasicLinkDestination">
- <xsl:with-param name="scope" select="$linkScope"/>
- <xsl:with-param name="href" select="@href"/>
- </xsl:call-template>
- <xsl:choose>
- <xsl:when test="not($linkScope = 'external') and not($referenceTitle = '')">
- <xsl:copy-of select="$referenceTitle"/>
- </xsl:when>
- <xsl:when test="not($linkScope = 'external')">
- <xsl:call-template name="insertPageNumberCitation">
- <xsl:with-param name="isTitleEmpty" select="'yes'"/>
- <xsl:with-param name="destination" select="$destination"/>
- <xsl:with-param name="element" select="$element"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates/>
- </xsl:otherwise>
- </xsl:choose>
- </text:a>
- <xsl:if test="not($linkScope = 'external') and not($referenceTitle = '')">
- <xsl:call-template name="insertPageNumberCitation">
- <xsl:with-param name="destination" select="$destination"/>
- <xsl:with-param name="element" select="$element"/>
- </xsl:call-template>
- </xsl:if>
- <!--
- Disable because of the CQ#8102 bug
- <xsl:if test="*[contains(@class, ' topic/desc ')]">
- <xsl:call-template name="insertLinkDesc"/>
- </xsl:if>
- -->
- <!-- Previously: skip if linkSope = external. New processing: pass
- linkscope to the template, let the template decide. -->
- <!--<xsl:if test="not($linkScope = 'external')">-->
- <xsl:call-template name="insertLinkShortDesc">
- <xsl:with-param name="destination" select="$destination"/>
- <xsl:with-param name="element" select="$element"/>
- <xsl:with-param name="linkScope" select="$linkScope"/>
- </xsl:call-template>
- <!--</xsl:if>-->
- </xsl:template>
- <xsl:template name="buildBasicLinkDestination">
- <xsl:param name="scope"/>
- <xsl:param name="href"/>
- <xsl:choose>
- <xsl:when test="(contains(@href, '://') and not(starts-with(@href, 'file://'))) or starts-with(@href, '/') or $scope = 'external'">
- <xsl:attribute name="xlink:href">
- <xsl:value-of select="$href"/>
- </xsl:attribute>
- </xsl:when>
- <xsl:when test="$scope = 'peer'">
- <xsl:attribute name="xlink:href">
- <xsl:value-of select="$href"/>
- </xsl:attribute>
- </xsl:when>
- <xsl:when test="contains($href, '#')">
- <xsl:attribute name="xlink:href">
- <xsl:value-of select="$href"/>
- </xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="xlink:href">
- <xsl:value-of select="$href"/>
- </xsl:attribute>
- <xsl:call-template name="brokenLinks">
- <xsl:with-param name="href" select="$href"/>
- </xsl:call-template>
- </xsl:otherwise>
- <!--xsl:otherwise>
- <xsl:attribute name="internal-destination">
- <xsl:value-of select="opentopic-func:getDestinationId($href)"/>
- </xsl:attribute>
- </xsl:otherwise-->
- </xsl:choose>
- </xsl:template>
- <xsl:template name="insertPageNumberCitation">
- <xsl:param name="isTitleEmpty"/>
- <xsl:param name="destination"/>
- <xsl:param name="element"/>
- <xsl:choose>
- <xsl:when test="not($element) or ($destination = '')"/>
- <xsl:when test="$isTitleEmpty">
- <!--
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Page'"/>
- <xsl:with-param name="params">
- <pagenum>
- <fo:inline>
- <fo:page-number-citation ref-id="{$destination}"/>
- </fo:inline>
- </pagenum>
- </xsl:with-param>
- </xsl:call-template>
- -->
- <text:s/>
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Page'"/>
- </xsl:call-template>
- <text:s/>
- <text:bookmark-ref text:reference-format="page" text:ref-name="{$destination}">
- </text:bookmark-ref>
- </xsl:when>
- <xsl:otherwise>
- <!--
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'On the page'"/>
- <xsl:with-param name="params">
- <xsl:element name="text:bookmark-ref">
- <xsl:attribute name="text:reference-format">page</xsl:attribute>
- <xsl:attribute name="text:ref-name"><xsl:value-of select="$destination"/></xsl:attribute>
- </xsl:element>
- </xsl:with-param>
- </xsl:call-template>
- -->
- <text:s/>
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'On the page'"/>
- </xsl:call-template>
- <text:s/>
- <text:bookmark-ref text:reference-format="page" text:ref-name="{$destination}">
- </text:bookmark-ref>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/linktext ')]" mode="processLink">
- <xsl:value-of select="*[contains(@class,' topic/linktext ')]"/>
- </xsl:template>
- <xsl:template match="*[contains(@class, ' topic/linklist ')]" mode="processLink">
- <text:line-break/>
- <xsl:apply-templates mode="processLink"/>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/linkinfo ')]" mode="processLink">
- <text:line-break/>
- <xsl:apply-templates/>
- </xsl:template>
- <xsl:template match="*[contains(@class,' topic/linkpool ')]" mode="processLink">
- <xsl:param name="topicType"/>
- <xsl:apply-templates mode="processLink">
- <xsl:with-param name="topicType" select="$topicType"/>
- </xsl:apply-templates>
- </xsl:template>
- <xsl:function name="opentopic-func:getDestinationId">
- <xsl:param name="href"/>
- <xsl:call-template name="getDestinationIdImpl">
- <xsl:with-param name="href" select="$href"/>
- </xsl:call-template>
- </xsl:function>
- <xsl:template name="getDestinationIdImpl">
- <xsl:param name="href"/>
- <xsl:variable name="topic-id" select="substring-after($href, '#')"/>
- <xsl:variable name="element-id" select="substring-after($topic-id, '/')"/>
- <xsl:choose>
- <xsl:when test="$element-id = ''">
- <xsl:value-of select="$topic-id"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$element-id"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!--Related links-->
- <xsl:template name="buildRelationships">
- <xsl:apply-templates select="." mode="buildRelationships"/>
- </xsl:template>
- <xsl:template match="*" mode="buildRelationships">
- <!--
- <xsl:param name="context" select="."/>
- <xsl:for-each select=".">
- </xsl:for-each>
- -->
- <xsl:if test="normalize-space($includeRelatedLinkRoles)">
- <xsl:variable name="parentCollectionType">
- <xsl:call-template name="getCollectionType">
- <xsl:with-param name="nodeType" select="'parent'"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="selfCollectionType">
- <xsl:call-template name="getCollectionType">
- <xsl:with-param name="nodeType" select="'self'"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="relatedConceptsTitle">
- <!--
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Related concepts'"/>
- </xsl:call-template>
- -->
- <text:p text:style-name="Default_20_Text">
- <text:span text:style-name="bold">
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Related concepts'"/>
- </xsl:call-template>
- </text:span>
- </text:p>
- </xsl:variable>
- <xsl:variable name="relatedTasksTitle">
- <!--
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Related tasks'"/>
- </xsl:call-template>
- -->
- <text:p text:style-name="Default_20_Text">
- <text:span text:style-name="bold">
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Related tasks'"/>
- </xsl:call-template>
- </text:span>
- </text:p>
- </xsl:variable>
- <xsl:variable name="relatedReferencesTitle">
- <!--
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Related references'"/>
- </xsl:call-template>
- -->
- <text:p text:style-name="Default_20_Text">
- <text:span text:style-name="bold">
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Related references'"/>
- </xsl:call-template>
- </text:span>
- </text:p>
- </xsl:variable>
- <xsl:variable name="relatedInformationTitle">
- <!--
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Related information'"/>
- </xsl:call-template>
- -->
- <text:p text:style-name="Default_20_Text">
- <text:span text:style-name="bold">
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Related information'"/>
- </xsl:call-template>
- </text:span>
- </text:p>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$selfCollectionType = 'none'">
- <xsl:call-template name="linkToChilds">
- <xsl:with-param name="listType" select="'none'"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="($selfCollectionType = 'unordered') or ($selfCollectionType = 'choice') or ($selfCollectionType = 'family')">
- <xsl:call-template name="linkToChilds">
- <xsl:with-param name="listType" select="'bulleted'"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$selfCollectionType = 'sequence'">
- <xsl:call-template name="linkToChilds">
- <xsl:with-param name="listType" select="'numbered'"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="($parentCollectionType = 'none') or ($parentCollectionType = 'unordered') or ($parentCollectionType = 'choice')">
- <xsl:call-template name="linkToParent"/>
- <!-- Creating relationships to the concepts -->
- <xsl:call-template name="createRelatedLinks">
- <xsl:with-param name="linkType" select="'concept'"/>
- <xsl:with-param name="title" select="$relatedConceptsTitle"/>
- </xsl:call-template>
- <!-- Creating relationships to the tasks -->
- <xsl:call-template name="createRelatedLinks">
- <xsl:with-param name="linkType" select="'task'"/>
- <xsl:with-param name="title" select="$relatedTasksTitle"/>
- </xsl:call-template>
- <!-- Creating relationships to the references -->
- <xsl:call-template name="createRelatedLinks">
- <xsl:with-param name="linkType" select="'reference'"/>
- <xsl:with-param name="title" select="$relatedReferencesTitle"/>
- </xsl:call-template>
- <!-- Creating relationships to the topics -->
- <xsl:call-template name="createRelatedLinks">
- <xsl:with-param name="linkType" select="'topic'"/>
- <xsl:with-param name="title" select="$relatedInformationTitle"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$parentCollectionType = 'sequence'">
- <xsl:call-template name="linkToParent"/>
- <xsl:call-template name="linkToPrevious"/>
- <xsl:call-template name="linkToNext"/>
- <!-- Creating relationships to the concepts -->
- <xsl:call-template name="createRelatedLinks">
- <xsl:with-param name="linkType" select="'concept'"/>
- <xsl:with-param name="title" select="$relatedConceptsTitle"/>
- </xsl:call-template>
- <!-- Creating relationships to the tasks -->
- <xsl:call-template name="createRelatedLinks">
- <xsl:with-param name="linkType" select="'task'"/>
- <xsl:with-param name="title" select="$relatedTasksTitle"/>
- </xsl:call-template>
- <!-- Creating relationships to the references -->
- <xsl:call-template name="createRelatedLinks">
- <xsl:with-param name="linkType" select="'reference'"/>
- <xsl:with-param name="title" select="$relatedReferencesTitle"/>
- </xsl:call-template>
- <!-- Creating relationships to the topics -->
- <xsl:call-template name="createRelatedLinks">
- <xsl:with-param name="linkType" select="'topic'"/>
- <xsl:with-param name="title" select="$relatedInformationTitle"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$parentCollectionType = 'family'">
- <xsl:call-template name="linkToParent"/>
- <!-- Creating relationships to the concepts -->
- <xsl:variable name="siblingConcepts" select="preceding-sibling::*[contains(@class, ' concept/concept ') and not(contains(@class, ' bkinfo/bkinfo '))] | following-sibling::*[contains(@class, ' concept/concept ') and not(contains(@class, ' bkinfo/bkinfo '))]"/>
- <xsl:call-template name="createMapLinks">
- <xsl:with-param name="nodeSet" select="$siblingConcepts"/>
- <xsl:with-param name="title" select="$relatedConceptsTitle"/>
- </xsl:call-template>
- <xsl:choose>
- <xsl:when test="$siblingConcepts">
- <xsl:call-template name="createRelatedLinks">
- <xsl:with-param name="linkType" select="'concept'"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="createRelatedLinks">
- <xsl:with-param name="linkType" select="'concept'"/>
- <xsl:with-param name="title" select="$relatedConceptsTitle"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- <!-- Creating relationships to the tasks -->
- <xsl:variable name="siblingTasks" select="preceding-sibling::*[contains(@class, ' task/task ') and not(contains(@class, ' bkinfo/bkinfo '))] | following-sibling::*[contains(@class, ' task/task ') and not(contains(@class, ' bkinfo/bkinfo '))]"/>
- <xsl:call-template name="createMapLinks">
- <xsl:with-param name="nodeSet" select="$siblingTasks"/>
- <xsl:with-param name="title" select="$relatedTasksTitle"/>
- </xsl:call-template>
- <xsl:choose>
- <xsl:when test="$siblingTasks">
- <xsl:call-template name="createRelatedLinks">
- <xsl:with-param name="linkType" select="'task'"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="createRelatedLinks">
- <xsl:with-param name="linkType" select="'task'"/>
- <xsl:with-param name="title" select="$relatedTasksTitle"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- <!-- Creating relationships to the references -->
- <xsl:variable name="siblingReferences" select="preceding-sibling::*[contains(@class, ' reference/reference ') and not(contains(@class, ' bkinfo/bkinfo '))] | following-sibling::*[contains(@class, ' reference/reference ') and not(contains(@class, ' bkinfo/bkinfo '))]"/>
- <xsl:call-template name="createMapLinks">
- <xsl:with-param name="nodeSet" select="$siblingReferences"/>
- <xsl:with-param name="title" select="$relatedReferencesTitle"/>
- </xsl:call-template>
- <xsl:choose>
- <xsl:when test="$siblingReferences">
- <xsl:call-template name="createRelatedLinks">
- <xsl:with-param name="linkType" select="'reference'"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="createRelatedLinks">
- <xsl:with-param name="linkType" select="'reference'"/>
- <xsl:with-param name="title" select="$relatedReferencesTitle"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- <!-- Creating relationships to the topics -->
- <xsl:variable name="siblingTopics" select="preceding-sibling::*[contains(@class, ' topic/topic ') and not(contains(@class, ' bkinfo/bkinfo ') or contains(@class, ' concept/concept ') or contains(@class, ' task/task ') or contains(@class, ' reference/reference '))] | following-sibling::*[contains(@class, ' topic/topic ') and not(contains(@class, ' bkinfo/bkinfo ') or contains(@class, ' concept/concept ') or contains(@class, ' task/task ') or contains(@class, ' reference/reference '))]"/>
- <xsl:call-template name="createMapLinks">
- <xsl:with-param name="nodeSet" select="$siblingTopics"/>
- <xsl:with-param name="title" select="$relatedInformationTitle"/>
- </xsl:call-template>
- <xsl:choose>
- <xsl:when test="$siblingTopics">
- <xsl:call-template name="createRelatedLinks">
- <xsl:with-param name="linkType" select="'topic'"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="createRelatedLinks">
- <xsl:with-param name="linkType" select="'topic'"/>
- <xsl:with-param name="title" select="$relatedInformationTitle"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- </xsl:choose>
- </xsl:if>
- </xsl:template>
- <xsl:template name="getCollectionType">
- <xsl:param name="nodeType"/>
- <xsl:variable name="collectionType">
- <xsl:choose>
- <xsl:when test="$nodeType = 'parent'">
- <xsl:value-of select="parent::*/@collection-type"/>
- </xsl:when>
- <xsl:when test="$nodeType = 'self'">
- <xsl:value-of select="@collection-type"/>
- </xsl:when>
- </xsl:choose>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$collectionType = 'unordered'">
- <xsl:value-of select="'none'"/>
- </xsl:when>
- <xsl:when test="$collectionType">
- <xsl:value-of select="$collectionType"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="'none'"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="linkToParent">
- <!-- Creating relationships to the parent -->
- <xsl:variable name="linksTitle">
- <!--
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Parent topic'"/>
- </xsl:call-template>
- -->
- <text:p text:style-name="Default_20_Text">
- <text:span text:style-name="bold">
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Parent topic'"/>
- </xsl:call-template>
- </text:span>
- </text:p>
- </xsl:variable>
- <xsl:call-template name="createMapLinks">
- <xsl:with-param name="nodeSet" select="parent::*[contains(@class, ' topic/topic ')]"/>
- <xsl:with-param name="title" select="$linksTitle"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template name="linkToNext">
- <!-- Creating relationships to the next sibling -->
- <xsl:variable name="linksTitle">
- <!--
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Next topic'"/>
- </xsl:call-template>
- -->
- <text:p text:style-name="Default_20_Text">
- <text:span text:style-name="bold">
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Next topic'"/>
- </xsl:call-template>
- </text:span>
- </text:p>
- </xsl:variable>
- <xsl:call-template name="createMapLinks">
- <xsl:with-param name="nodeSet" select="following-sibling::*[contains(@class, ' topic/topic ')][1]"/>
- <xsl:with-param name="title" select="$linksTitle"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template name="linkToPrevious">
- <!-- Creating relationships to the previous sibling -->
- <xsl:variable name="linksTitle">
- <!--
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Previous topic'"/>
- </xsl:call-template>
- -->
- <text:p text:style-name="Default_20_Text">
- <text:span text:style-name="bold">
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Previous topic'"/>
- </xsl:call-template>
- </text:span>
- </text:p>
- </xsl:variable>
- <xsl:call-template name="createMapLinks">
- <xsl:with-param name="nodeSet" select="preceding-sibling::*[contains(@class, ' topic/topic ')][1]"/>
- <xsl:with-param name="title" select="$linksTitle"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template name="linkToChilds">
- <!-- Creating relationships to the childs -->
- <xsl:param name="listType"/>
- <xsl:variable name="linksTitle">
- <!--
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Child topics'"/>
- </xsl:call-template>
- -->
- <text:p text:style-name="Default_20_Text">
- <text:span text:style-name="bold">
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Child topics'"/>
- </xsl:call-template>
- </text:span>
- </text:p>
- </xsl:variable>
- <xsl:call-template name="createMapLinks">
- <xsl:with-param name="nodeSet" select="*[contains(@class, ' topic/topic ')] | *[contains(@class,' topic/dita ')]/*[contains(@class, ' topic/topic ')]"/>
- <xsl:with-param name="title" select="$linksTitle"/>
- <xsl:with-param name="listType" select="$listType"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template name="createMapLinks">
- <xsl:param name="nodeSet"/>
- <xsl:param name="title"/>
- <xsl:param name="listType" select="'none'"/>
- <xsl:variable name="linkNodes">
- <xsl:if test="$nodeSet">
- <xsl:choose>
- <xsl:when test="$listType = 'bulleted'">
- <xsl:call-template name="createMapLinksUnordered">
- <xsl:with-param name="nodeSet" select="$nodeSet"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$listType = 'numbered'">
- <xsl:call-template name="createMapLinksOrdered">
- <xsl:with-param name="nodeSet" select="$nodeSet"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$listType = 'none'">
- <text:p text:style-name="Default_20_Text">
- <xsl:for-each select="$nodeSet">
- <text:a xlink:href="concat('#', @id)">
- <xsl:apply-templates select="child::*[contains(@class, ' topic/title ')]" mode="insert-text"/>
- </text:a>
- <text:line-break/>
- </xsl:for-each>
- </text:p>
- </xsl:when>
- </xsl:choose>
- </xsl:if>
- </xsl:variable>
- <xsl:if test="($linkNodes//text:list) or ($linkNodes//text:p)">
- <xsl:if test="$title">
- <xsl:value-of select="$title"/>
- </xsl:if>
- <xsl:copy-of select="$linkNodes"/>
- </xsl:if>
- </xsl:template>
- <xsl:template name="createMapLinksUnordered">
- <xsl:param name="nodeSet"/>
- <text:list text:style-name="list_style">
- <xsl:for-each select="$nodeSet">
- <text:list-item>
- <!--
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Unordered List bullet'"/>
- </xsl:call-template>
- -->
- <text:p text:style-name="Default_20_Text">
- <text:span text:style-name="bold">
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Unordered List bullet'"/>
- </xsl:call-template>
- </text:span>
- </text:p>
- <text:p text:style-name="Default_20_Text">
- <text:a xlink:href="concat('#' , @id)">
- <xsl:apply-templates select="child::*[contains(@class, ' topic/title ')]" mode="insert-text"/>
- </text:a>
- </text:p>
- </text:list-item>
- </xsl:for-each>
- </text:list>
- </xsl:template>
- <xsl:template name="createMapLinksOrdered">
- <xsl:param name="nodeSet"/>
- <text:list text:style-nam="ordered_list_style">
- <xsl:for-each select="$nodeSet">
- <text:list-item>
-
- <text:p text:style-name="Default_20_Text">
- <xsl:value-of select="count(preceding-sibling::*[contains(@class,' topic/topic ')])"/>
- </text:p>
-
- <text:p text:style-name="Default_20_Text">
- <text:a xlink:href="concat('#', @id)">
- <xsl:apply-templates select="child::*[contains(@class, ' topic/title ')]" mode="insert-text"/>
- </text:a>
- </text:p>
-
- </text:list-item>
- </xsl:for-each>
- </text:list>
- </xsl:template>
- <xsl:template name="createRelatedLinks">
- <xsl:param name="linkType"/>
- <xsl:param name="title"/>
- <xsl:variable name="id" select="@id"/>
- <xsl:if test="$relatedTopicrefs/@id = $id">
- <xsl:variable name="resultLinks">
- <xsl:for-each select="$relatedTopicrefs[@id = $id]">
- <xsl:choose>
- <xsl:when test="ancestor::*[contains(@class, ' map/reltable ')]/*[contains(@class, ' map/relheader ')]">
- <xsl:variable name="topicTypeCellSpec" select="ancestor::*[contains(@class, ' map/reltable ')]/*[contains(@class, ' map/relheader ')]/*[contains(@class, ' map/relcolspec ')][@type = $linkType]"/>
- <xsl:if test="$topicTypeCellSpec">
- <xsl:variable name="currPosition" select="count(ancestor::*[contains(@class, ' map/relcell ')][1]/preceding-sibling::*) + 1"/>
- <xsl:variable name="position">
- <xsl:for-each select="$topicTypeCellSpec">
- <xsl:value-of select="count(preceding-sibling::*) + 1"/>
- </xsl:for-each>
- </xsl:variable>
- <xsl:if test="not($currPosition = $position)">
- <xsl:for-each select="ancestor::*[contains(@class, ' map/relrow ')]/*[contains(@class, ' map/relcell ')][position() = $position]//*[contains(@class, ' map/topicref ')]">
- <xsl:variable name="relatedTopic" select="key('key_anchor',@id)[1]"/>
- <text:p text:style-name="Default_20_Text">
- <text:a xlink:href="concat('#', $id)">
- <xsl:apply-templates select="$relatedTopic/*[contains(@class,' topic/title ')]" mode="insert-text"/>
- </text:a>
- </text:p>
- </xsl:for-each>
- </xsl:if>
- </xsl:if>
- </xsl:when>
- <xsl:otherwise>
- <xsl:for-each select="ancestor::*[contains(@class, ' map/relcell ')][1]/preceding-sibling::*//*[contains(@class, ' map/topicref ')] | ancestor::*[contains(@class, ' map/relcell ')][1]/following-sibling::*//*[contains(@class, ' map/topicref ')]">
- <xsl:variable name="relatedTopic" select="key('key_anchor',@id)[1]"/>
- <xsl:choose>
- <xsl:when test="$linkType = 'topic'">
- <xsl:if test="contains($relatedTopic/@class, ' topic/topic ') and not(contains($relatedTopic/@class, ' concept/concept ') or contains($relatedTopic/@class, ' task/task ') or contains($relatedTopic/@class, ' reference/reference '))">
- <text:p text:style-name="Default_20_Text">
- <text:a xlink:href="concat('#', $id)">
- <xsl:apply-templates select="$relatedTopic/*[contains(@class,' topic/title ')]" mode="insert-text"/>
- </text:a>
- </text:p>
- </xsl:if>
- </xsl:when>
- <xsl:when test="$linkType = 'task'">
- <xsl:if test="contains($relatedTopic/@class, ' task/task ')">
- <text:p text:style-name="Default_20_Text">
- <text:a xlink:href="concat('#', $id)">
- <xsl:apply-templates select="$relatedTopic/*[contains(@class,' topic/title ')]" mode="insert-text"/>
- </text:a>
- </text:p>
- </xsl:if>
- </xsl:when>
- <xsl:when test="$linkType = 'concept'">
- <xsl:if test="contains($relatedTopic/@class, ' concept/concept ')">
- <text:p text:style-name="Default_20_Text">
- <text:a xlink:href="concat('#', $id)">
- <xsl:apply-templates select="$relatedTopic/*[contains(@class,' topic/title ')]" mode="insert-text"/>
- </text:a>
- </text:p>
- </xsl:if>
- </xsl:when>
- <xsl:when test="$linkType = 'reference'">
- <xsl:if test="contains($relatedTopic/@class, ' reference/reference ')">
- <text:p text:style-name="Default_20_Text">
- <text:a xlink:href="concat('#', $id)">
- <xsl:apply-templates select="$relatedTopic/*[contains(@class,' topic/title ')]" mode="insert-text"/>
- </text:a>
- </text:p>
- </xsl:if>
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:variable>
- <xsl:if test="$resultLinks/*">
- <xsl:if test="$title">
- <text:p text:style-name="Default_20_Text">
- <xsl:value-of select="$title"/>
- </text:p>
- </xsl:if>
- <xsl:copy-of select="$resultLinks"/>
- </xsl:if>
- </xsl:if>
- </xsl:template>
- <xsl:template name="brokenLinks">
- <xsl:param name="href"/>
- <xsl:call-template name="output-message">
- <xsl:with-param name="id" select="'DOTX063W'"/>
- <xsl:with-param name="msgparams">%1=<xsl:value-of select="$href"/></xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!--create prerequisite links with all dups eliminated. -->
- <!-- Omit prereq links from unordered related-links (handled by mode="prereqs" template). -->
- <xsl:key name="omit-from-unordered-links" match="*[@importance='required' and (not(@role) or @role='sibling' or @role='friend' or @role='cousin')]" use="1"/>
- <xsl:template match="*[contains(@class,' topic/related-links ')]" mode="prereqs">
-
- <!--if there are any prereqs create a list with dups-->
- <xsl:if test="descendant::*[contains(@class, ' topic/link ')][not(ancestor::*[contains(@class, ' topic/linklist ')])][@importance='required' and (not(@role) or @role='sibling' or @role='friend' or @role='previous' or @role='cousin')]">
- <text:p>
- <text:span text:style-name="default_text_style">
- <xsl:call-template name="getVariable">
- <xsl:with-param name="id" select="'Prerequisites'"/>
- </xsl:call-template>
- </text:span>
- </text:p>
-
- <!--only create link if there is an href, its importance is required, and the role is compatible (don't want a prereq showing up for a "next" or "parent" link, for example) - remove dups-->
- <xsl:apply-templates mode="prereqs" select="descendant::*[generate-id(.)=generate-id(key('link',concat(ancestor::*[contains(@class, ' topic/related-links ')]/parent::*[contains(@class, ' topic/topic ')]/@id, ' ', @href,@type,@role,@platform,@audience,@importance,@outputclass,@keyref,@scope,@format,@otherrole,@product,@otherprops,@rev,@class,normalize-space(child::*[1])))[1])] [@href] [@importance='required' and (not(@role) or @role='sibling' or @role='friend' or @role='previous' or @role='cousin')] [not(ancestor::*[contains(@class, ' topic/linklist ')])]"/>
- </xsl:if>
- </xsl:template>
-
- <xsl:template mode="prereqs" match="*[contains(@class, ' topic/link ')]" priority="2">
- <!-- Allow for unknown metadata (future-proofing) -->
- <xsl:apply-templates select="*[contains(@class,' topic/data ') or contains(@class,' topic/foreign ')]"/>
- <xsl:variable name="samefile">
- <xsl:call-template name="check_file_location"/>
- </xsl:variable>
- <xsl:variable name="href-value">
- <xsl:call-template name="format_href_value"/>
- </xsl:variable>
- <text:p text:style-name="Default_20_Text">
- <xsl:call-template name="create_related_links">
- <xsl:with-param name="samefile" select="$samefile"/>
- <xsl:with-param name="href-value" select="$href-value"/>
- </xsl:call-template>
- </text:p>
- </xsl:template>
- </xsl:stylesheet>
|