Ignore:
Timestamp:
12/10/2013 11:37:38 PM (11 years ago)
Author:
Krejzi <krejzi@…>
Branches:
7.5-systemd, 7.6-systemd, 7.7-systemd, 7.8-systemd, 7.9-systemd
Children:
112db9d
Parents:
f2a5108
Message:

Import new branch

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/systemd/BOOK@10389 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

File:
1 moved

Legend:

Unmodified
Added
Removed
  • stylesheets/lfs-xsl/docbook-xsl-1.78.1/fo/xref.xsl

    rf2a5108 rb1a51ac1  
    44                xmlns:exsl="http://exslt.org/common"
    55                xmlns:xlink='http://www.w3.org/1999/xlink'
    6                 exclude-result-prefixes="exsl"
     6                exclude-result-prefixes="exsl xlink"
    77                version='1.0'>
    88
    99<!-- ********************************************************************
    10      $Id$
     10     $Id: xref.xsl 9723 2013-02-06 13:08:06Z kosek $
    1111     ********************************************************************
    1212
     
    2727    <xsl:call-template name="object.id"/>
    2828  </xsl:variable>
    29   <fo:inline id="{$id}"/>
     29
     30  <xsl:variable name="wrapper.name">
     31    <xsl:call-template name="inline.or.block"/>
     32  </xsl:variable>
     33
     34  <xsl:element name="{$wrapper.name}">
     35    <xsl:attribute name="id">
     36      <xsl:value-of select="$id"/>
     37    </xsl:attribute>
     38  </xsl:element>
    3039</xsl:template>
    3140
     
    134143                  and ( $insert.xref.page.number = 'yes'
    135144                     or $insert.xref.page.number = '1')
    136                   or local-name($target) = 'para'">
     145                  or (local-name($target) = 'para' and
     146                      $xrefstyle = '')">
    137147      <xsl:apply-templates select="$target" mode="page.citation">
    138148        <xsl:with-param name="id" select="$target/@id|$target/@xml:id"/>
     
    233243
    234244  <xsl:choose>
    235     <xsl:when test="function-available('exsl:node-set')">
     245    <xsl:when test="$exsl.node.set.available != 0">
    236246      <xsl:apply-templates select="exsl:node-set($endterm)" mode="remove-ids"/>
    237247    </xsl:when>
     
    309319                     |itemizedlist|legalnotice|lot|msg|msgexplan|msgmain
    310320                     |msgrel|msgset|msgsub|note|orderedlist|partintro
    311                      |productionset|qandadiv|refsynopsisdiv|segmentedlist
     321                     |productionset|qandadiv|refsynopsisdiv|screenshot|segmentedlist
    312322                     |set|setindex|sidebar|tip|toc|variablelist|warning"
    313323              mode="xref-to">
     
    396406</xsl:template>
    397407
    398 <xsl:template match="dedication|preface|chapter|appendix" mode="xref-to">
     408<xsl:template match="dedication|acknowledgements|preface|chapter|appendix" mode="xref-to">
    399409  <xsl:param name="referrer"/>
    400410  <xsl:param name="xrefstyle"/>
     
    516526</xsl:template>
    517527
    518 <xsl:template match="glossterm" mode="xref-to">
     528<xsl:template match="glossterm|firstterm" mode="xref-to">
    519529  <xsl:apply-templates/>
    520530</xsl:template>
     
    562572</xsl:template>
    563573
    564 <xsl:template match="bridgehead" mode="xref-to">
     574<xsl:template match="topic" mode="xref-to">
    565575  <xsl:param name="referrer"/>
    566576  <xsl:param name="xrefstyle"/>
     
    573583    <xsl:with-param name="verbose" select="$verbose"/>
    574584  </xsl:apply-templates>
    575   <!-- What about "in Chapter X"? -->
    576 </xsl:template>
    577 
    578 <xsl:template match="qandaset" mode="xref-to">
     585</xsl:template>
     586
     587<xsl:template match="bridgehead" mode="xref-to">
    579588  <xsl:param name="referrer"/>
    580589  <xsl:param name="xrefstyle"/>
     
    587596    <xsl:with-param name="verbose" select="$verbose"/>
    588597  </xsl:apply-templates>
    589 </xsl:template>
    590 
    591 <xsl:template match="qandadiv" mode="xref-to">
     598  <!-- What about "in Chapter X"? -->
     599</xsl:template>
     600
     601<xsl:template match="qandaset" mode="xref-to">
    592602  <xsl:param name="referrer"/>
    593603  <xsl:param name="xrefstyle"/>
     
    602612</xsl:template>
    603613
    604 <xsl:template match="qandaentry" mode="xref-to">
    605   <xsl:param name="referrer"/>
    606   <xsl:param name="xrefstyle"/>
    607   <xsl:param name="verbose" select="1"/>
    608 
    609   <xsl:apply-templates select="question[1]" mode="object.xref.markup">
    610     <xsl:with-param name="purpose" select="'xref'"/>
    611     <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
    612     <xsl:with-param name="referrer" select="$referrer"/>
    613     <xsl:with-param name="verbose" select="$verbose"/>
    614   </xsl:apply-templates>
    615 </xsl:template>
    616 
    617 <xsl:template match="question|answer" mode="xref-to">
     614<xsl:template match="qandadiv" mode="xref-to">
    618615  <xsl:param name="referrer"/>
    619616  <xsl:param name="xrefstyle"/>
     
    626623    <xsl:with-param name="verbose" select="$verbose"/>
    627624  </xsl:apply-templates>
     625</xsl:template>
     626
     627<xsl:template match="qandaentry" mode="xref-to">
     628  <xsl:param name="referrer"/>
     629  <xsl:param name="xrefstyle"/>
     630  <xsl:param name="verbose" select="1"/>
     631
     632  <xsl:apply-templates select="question[1]" mode="xref-to">
     633    <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
     634    <xsl:with-param name="referrer" select="$referrer"/>
     635    <xsl:with-param name="verbose" select="$verbose"/>
     636  </xsl:apply-templates>
     637</xsl:template>
     638
     639<xsl:template match="question|answer" mode="xref-to">
     640  <xsl:param name="referrer"/>
     641  <xsl:param name="xrefstyle"/>
     642  <xsl:param name="verbose" select="1"/>
     643
     644  <xsl:choose>
     645    <xsl:when test="string-length(label) != 0">
     646      <xsl:apply-templates select="." mode="label.markup"/>
     647    </xsl:when>
     648    <xsl:otherwise>
     649      <xsl:apply-templates select="." mode="object.xref.markup">
     650        <xsl:with-param name="purpose" select="'xref'"/>
     651        <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
     652        <xsl:with-param name="referrer" select="$referrer"/>
     653        <xsl:with-param name="verbose" select="$verbose"/>
     654      </xsl:apply-templates>
     655    </xsl:otherwise>
     656  </xsl:choose>
    628657</xsl:template>
    629658
     
    743772</xsl:template>
    744773
    745 <xsl:template match="para" mode="xref-to">
     774<!-- These are elements for which no link text exists, so an xref to one
     775     uses the xrefstyle attribute if specified, or if not it falls back
     776     to the container element's link text -->
     777<xsl:template match="para|phrase|simpara|anchor|quote" mode="xref-to">
    746778  <xsl:param name="referrer"/>
    747779  <xsl:param name="xrefstyle"/>
     
    755787                                       |ancestor::sect4
    756788                                       |ancestor::sect5
     789                                       |ancestor::topic
    757790                                       |ancestor::refsection
    758791                                       |ancestor::refsect1
     
    764797                                       |ancestor::partintro
    765798                                       |ancestor::dedication
     799                                       |ancestor::acknowledgements
    766800                                       |ancestor::colophon
    767801                                       |ancestor::bibliography
     
    772806                                       |ancestor::varlistentry)[last()]"/>
    773807
    774   <xsl:apply-templates select="$context" mode="xref-to">
    775     <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
    776     <xsl:with-param name="referrer" select="$referrer"/>
    777     <xsl:with-param name="verbose" select="$verbose"/>
    778   </xsl:apply-templates>
     808  <xsl:choose>
     809    <xsl:when test="$xrefstyle != ''">
     810      <xsl:apply-templates select="." mode="object.xref.markup">
     811        <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
     812        <xsl:with-param name="referrer" select="$referrer"/>
     813        <xsl:with-param name="verbose" select="$verbose"/>
     814      </xsl:apply-templates>
     815    </xsl:when>
     816    <xsl:otherwise>
     817      <xsl:if test="$verbose != 0">
     818        <xsl:message>
     819          <xsl:text>WARNING: xref to &lt;</xsl:text>
     820          <xsl:value-of select="local-name()"/>
     821          <xsl:text> id="</xsl:text>
     822          <xsl:value-of select="@id|@xml:id"/>
     823          <xsl:text>"&gt; has no generated text. Trying its ancestor elements.</xsl:text>
     824        </xsl:message>
     825      </xsl:if>
     826      <xsl:apply-templates select="$context" mode="xref-to">
     827        <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
     828        <xsl:with-param name="referrer" select="$referrer"/>
     829        <xsl:with-param name="verbose" select="$verbose"/>
     830      </xsl:apply-templates>
     831    </xsl:otherwise>
     832  </xsl:choose>
     833</xsl:template>
     834
     835<xsl:template match="indexterm" mode="xref-to">
     836  <xsl:value-of select="primary"/>
     837</xsl:template>
     838
     839<xsl:template match="primary|secondary|tertiary" mode="xref-to">
     840  <xsl:value-of select="."/>
    779841</xsl:template>
    780842
     
    825887        <!-- Use the xlink:href if no other text -->
    826888        <xsl:when test="@xlink:href">
    827           <xsl:value-of select="@xlink:href"/>
     889          <fo:inline hyphenate="false">
     890            <xsl:call-template name="hyphenate-url">
     891              <xsl:with-param name="url" select="@xlink:href"/>
     892            </xsl:call-template>
     893          </fo:inline>
    828894        </xsl:when>
    829895        <xsl:otherwise>
     
    881947                 external-destination="{$ulink.url}">
    882948    <xsl:choose>
    883       <xsl:when test="count(child::node())=0">
    884         <xsl:call-template name="hyphenate-url">
    885           <xsl:with-param name="url" select="$url"/>
    886         </xsl:call-template>
     949      <xsl:when test="count(child::node())=0 or (string(.) = $url)">
     950        <fo:inline hyphenate="false">
     951          <xsl:call-template name="hyphenate-url">
     952            <xsl:with-param name="url" select="$url"/>
     953          </xsl:call-template>
     954        </fo:inline>
    887955      </xsl:when>
    888956      <xsl:otherwise>
     
    891959    </xsl:choose>
    892960  </fo:basic-link>
     961  <!-- * Call the template for determining whether the URL for this -->
     962  <!-- * hyperlink is displayed, and how to display it (either inline or -->
     963  <!-- * as a numbered footnote). -->
     964  <xsl:call-template name="hyperlink.url.display">
     965    <xsl:with-param name="url" select="$url"/>
     966    <xsl:with-param name="ulink.url" select="$ulink.url"/>
     967  </xsl:call-template>
     968</xsl:template>
     969
     970<xsl:template name="hyperlink.url.display">
     971  <!-- * This template is called for all external hyperlinks (ulinks and -->
     972  <!-- * for all simple xlinks); it determines whether the URL for the -->
     973  <!-- * hyperlink is displayed, and how to display it (either inline or -->
     974  <!-- * as a numbered footnote). -->
     975  <xsl:param name="url"/>
     976  <xsl:param name="ulink.url">
     977    <!-- * ulink.url is just the value of the URL wrapped in 'url(...)' -->
     978    <xsl:call-template name="fo-external-image">
     979      <xsl:with-param name="filename" select="$url"/>
     980    </xsl:call-template>
     981  </xsl:param>
    893982
    894983  <xsl:if test="count(child::node()) != 0
    895984                and string(.) != $url
    896985                and $ulink.show != 0">
    897     <!-- yes, show the URI -->
     986    <!-- * Display the URL for this hyperlink only if it is non-empty, -->
     987    <!-- * and the value of its content is not a URL that is the same as -->
     988    <!-- * URL it links to, and if ulink.show is non-zero. -->
    898989    <xsl:choose>
    899       <xsl:when test="$ulink.footnotes != 0 and not(ancestor::footnote)">
     990      <xsl:when test="$ulink.footnotes != 0 and not(ancestor::footnote) and not(ancestor::*[@floatstyle='before'])">
     991        <!-- * ulink.show and ulink.footnote are both non-zero; that -->
     992        <!-- * means we display the URL as a footnote (instead of inline) -->
    900993        <fo:footnote>
    901994          <xsl:call-template name="ulink.footnote.number"/>
     
    9121005      </xsl:when>
    9131006      <xsl:otherwise>
     1007        <!-- * ulink.show is non-zero, but ulink.footnote is not; that -->
     1008        <!-- * means we display the URL inline -->
    9141009        <fo:inline hyphenate="false">
     1010          <!-- * put square brackets around the URL -->
    9151011          <xsl:text> [</xsl:text>
    9161012          <fo:basic-link external-destination="{$ulink.url}">
     
    9381034    </xsl:choose>
    9391035    <xsl:variable name="fnum">
     1036      <!-- * Determine the footnote number to display for this hyperlink, -->
     1037      <!-- * by counting all foonotes, ulinks, and any elements that have -->
     1038      <!-- * an xlink:href attribute that meets the following criteria: -->
     1039      <!-- * -->
     1040      <!-- * - the content of the element is not a URI that is the same -->
     1041      <!-- *   URI as the value of the href attribute -->
     1042      <!-- * - the href attribute is not an internal ID reference (does -->
     1043      <!-- *   not start with a hash sign) -->
     1044      <!-- * - the href is not part of an olink reference (the element -->
     1045      <!-- * - does not have an xlink:role attribute that indicates it is -->
     1046      <!-- *   an olink, and the href does not contain a hash sign) -->
     1047      <!-- * - the element either has no xlink:type attribute or has -->
     1048      <!-- *   an xlink:type attribute whose value is 'simple' -->
    9401049      <!-- FIXME: list in @from is probably not complete -->
    9411050      <xsl:number level="any"
    942                   from="chapter|appendix|preface|article|refentry|bibliography[not(parent::article)]"
    943                   count="footnote[not(@label)][not(ancestor::tgroup)]|ulink[node()][@url != .][not(ancestor::footnote)]"
     1051                  from="chapter|appendix|preface|article|refentry|bibliography[not(parent::article)]"
     1052                  count="footnote[not(@label)][not(ancestor::tgroup)]
     1053                  |ulink[node()][@url != .][not(ancestor::footnote)]
     1054                  |*[node()][@xlink:href][not(@xlink:href = .)][not(starts-with(@xlink:href,'#'))]
     1055                    [not(contains(@xlink:href,'#') and @xlink:role = $xolink.role)]
     1056                    [not(@xlink:type) or @xlink:type='simple']
     1057                    [not(ancestor::footnote)]"
    9441058                  format="1"/>
    9451059    </xsl:variable>
     
    9841098  <!-- olink content may be passed in from xlink olink -->
    9851099  <xsl:param name="content" select="NOTANELEMENT"/>
    986 
    987   <xsl:call-template name="anchor"/>
    988 
    989   <xsl:variable name="localinfo" select="@localinfo"/>
    9901100
    9911101  <xsl:choose>
     
    10821192      <xsl:variable name="hottext">
    10831193        <xsl:choose>
    1084           <xsl:when test="$content">
     1194          <xsl:when test="string-length($content) != 0">
    10851195            <xsl:copy-of select="$content"/>
    10861196          </xsl:when>
     
    11161226          <fo:basic-link internal-destination="{$linkend}"
    11171227                       xsl:use-attribute-sets="xref.properties">
     1228            <xsl:call-template name="anchor"/>
    11181229            <xsl:copy-of select="$hottext"/>
    11191230            <xsl:copy-of select="$olink.page.citation"/>
     
    11221233        <xsl:when test="$href != ''">
    11231234          <xsl:choose>
     1235            <xsl:when test="$fop1.extensions != 0">
     1236              <xsl:variable name="mybeg" select="substring-before($href,'#')"/>
     1237              <xsl:variable name="myend" select="substring-after($href,'#')"/>
     1238              <fo:basic-link external-destination="url({concat($mybeg,'#dest=',$myend)})"
     1239                             xsl:use-attribute-sets="olink.properties">
     1240                <xsl:copy-of select="$hottext"/>
     1241              </fo:basic-link>
     1242              <xsl:copy-of select="$olink.page.citation"/>
     1243              <xsl:copy-of select="$olink.docname.citation"/>
     1244            </xsl:when>
    11241245            <xsl:when test="$xep.extensions != 0">
    11251246              <fo:basic-link external-destination="url({$href})"
    11261247                             xsl:use-attribute-sets="olink.properties">
     1248                <xsl:call-template name="anchor"/>
    11271249                <xsl:copy-of select="$hottext"/>
    11281250              </fo:basic-link>
     
    11941316      <xsl:for-each select="$target.database" >
    11951317        <xsl:value-of
    1196                   select="key('targetptr-key', $olink.key)/@lang" />
     1318                  select="key('targetptr-key', $olink.key)[1]/@lang" />
    11971319      </xsl:for-each>
    11981320    </xsl:variable>
     
    12191341
    12201342
    1221 <xsl:template name="olink.outline">
    1222   <xsl:param name="outline.base.uri"/>
    1223   <xsl:param name="localinfo"/>
    1224   <xsl:param name="return" select="href"/>
    1225 
    1226   <xsl:message terminate="yes">Fatal error: olink.outline template: what is this supposed to do?</xsl:message>
    1227 </xsl:template>
    1228 
    12291343<!-- ==================================================================== -->
    12301344
     
    12371351                    or local-name($target) = 'table'
    12381352                    or local-name($target) = 'dedication'
     1353                    or local-name($target) = 'acknowledgements'
    12391354                    or local-name($target) = 'preface'
    12401355                    or local-name($target) = 'bibliography'
     
    13171432
    13181433  <xsl:choose>
    1319     <!-- FIXME: what about the case where titleabbrev is inside the info? -->
    1320     <xsl:when test="$purpose = 'xref' and titleabbrev">
    1321       <xsl:apply-templates select="." mode="titleabbrev.markup"/>
     1434    <xsl:when test="$purpose = 'xref'">
     1435      <xsl:copy-of select="$title"/>
    13221436    </xsl:when>
    13231437    <xsl:otherwise>
Note: See TracChangeset for help on using the changeset viewer.