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/xhtml/xref.xsl

    rf2a5108 rb1a51ac1  
    55
    66<!-- ********************************************************************
    7      $Id$
     7     $Id: xref.xsl 9713 2013-01-22 22:08:30Z bobstayton $
    88     ********************************************************************
    99
     
    2020
    2121<xsl:template match="anchor">
    22   <xsl:call-template name="anchor"/>
     22  <xsl:choose>
     23    <xsl:when test="$generate.id.attributes = 0">
     24      <xsl:call-template name="anchor"/>
     25    </xsl:when>
     26    <xsl:otherwise>
     27      <span>
     28        <xsl:call-template name="id.attribute"/>
     29      </span>
     30    </xsl:otherwise>
     31  </xsl:choose>
    2332</xsl:template>
    2433
     
    152161          </xsl:message>
    153162          <a href="{$href}">
    154             <xsl:apply-templates select="." mode="class.attribute"/>
     163            <xsl:apply-templates select="." mode="common.html.attributes"/>
     164            <xsl:call-template name="id.attribute"/>
    155165            <xsl:text>???</xsl:text>
    156166          </a>
     
    158168        <xsl:otherwise>
    159169          <a href="{$href}">
    160             <xsl:apply-templates select="." mode="class.attribute"/>
     170            <xsl:apply-templates select="." mode="common.html.attributes"/>
     171            <xsl:call-template name="id.attribute"/>
    161172            <xsl:apply-templates select="$etarget" mode="endterm"/>
    162173          </a>
     
    167178    <xsl:when test="$target/@xreflabel">
    168179      <a>
    169         <xsl:apply-templates select="." mode="class.attribute"/>
     180        <xsl:apply-templates select="." mode="common.html.attributes"/>
    170181        <xsl:attribute name="href">
    171182          <xsl:call-template name="href.target">
     
    192203      <a href="{$href}">
    193204        <xsl:apply-templates select="." mode="class.attribute"/>
    194         <xsl:if test="$target/title or $target/*/title">
     205        <xsl:if test="$target/title or $target/info/title">
    195206          <xsl:attribute name="title">
    196207            <xsl:apply-templates select="$target" mode="xref-title"/>
     
    224235  <!-- Process the children of the endterm element -->
    225236  <xsl:variable name="endterm">
    226     <xsl:apply-templates select="child::node()"/>
     237    <xsl:apply-templates select="child::node()" mode="no.anchor.mode"/>
    227238  </xsl:variable>
    228239
    229240  <xsl:choose>
    230     <xsl:when test="function-available('exsl:node-set')">
     241    <xsl:when test="$exsl.node.set.available != 0">
    231242      <xsl:apply-templates select="exsl:node-set($endterm)" mode="remove-ids"/>
    232243    </xsl:when>
     
    328339</xsl:template>
    329340
    330 <xsl:template match="abstract|authorblurb|personblurb|bibliodiv|bibliomset                      |biblioset|blockquote|calloutlist|caution|colophon                      |constraintdef|formalpara|glossdiv|important|indexdiv                      |itemizedlist|legalnotice|lot|msg|msgexplan|msgmain                      |msgrel|msgset|msgsub|note|orderedlist|partintro                      |productionset|qandadiv|refsynopsisdiv|segmentedlist                      |set|setindex|sidebar|tip|toc|variablelist|warning" mode="xref-to">
     341<xsl:template match="abstract|authorblurb|personblurb|bibliodiv|bibliomset                      |biblioset|blockquote|calloutlist|caution|colophon                      |constraintdef|formalpara|glossdiv|important|indexdiv                      |itemizedlist|legalnotice|lot|msg|msgexplan|msgmain                      |msgrel|msgset|msgsub|note|orderedlist|partintro                      |productionset|qandadiv|refsynopsisdiv|screenshot|segmentedlist                      |set|setindex|sidebar|tip|toc|variablelist|warning" mode="xref-to">
    331342  <xsl:param name="referrer"/>
    332343  <xsl:param name="xrefstyle"/>
     
    403414</xsl:template>
    404415
    405 <xsl:template match="dedication|preface|chapter|appendix|article" mode="xref-to">
     416<xsl:template match="dedication|acknowledgements|preface|chapter|appendix|article" mode="xref-to">
    406417  <xsl:param name="referrer"/>
    407418  <xsl:param name="xrefstyle"/>
     
    455466            </xsl:when>
    456467            <xsl:when test="local-name($entry/*[1]) = 'abbrev'">
    457               <xsl:apply-templates select="$entry/*[1]"/>
     468              <xsl:apply-templates select="$entry/*[1]" mode="no.anchor.mode"/>
    458469            </xsl:when>
    459470            <xsl:otherwise>
     
    479490        </xsl:when>
    480491        <xsl:when test="local-name(*[1]) = 'abbrev'">
    481           <xsl:apply-templates select="*[1]"/>
     492          <xsl:apply-templates select="*[1]" mode="no.anchor.mode"/>
    482493        </xsl:when>
    483494        <xsl:otherwise>
     
    510521      <xsl:choose>
    511522        <xsl:when test="acronym|abbrev">
    512           <xsl:apply-templates select="(acronym|abbrev)[1]"/>
     523          <xsl:apply-templates select="(acronym|abbrev)[1]" mode="no.anchor.mode"/>
    513524        </xsl:when>
    514525        <xsl:otherwise>
     
    531542</xsl:template>
    532543
    533 <xsl:template match="glossterm" mode="xref-to">
    534   <xsl:apply-templates/>
     544<xsl:template match="glossterm|firstterm" mode="xref-to">
     545  <xsl:apply-templates mode="no.anchor.mode"/>
    535546</xsl:template>
    536547
     
    575586</xsl:template>
    576587
     588<xsl:template match="topic" mode="xref-to">
     589  <xsl:param name="referrer"/>
     590  <xsl:param name="xrefstyle"/>
     591  <xsl:param name="verbose" select="1"/>
     592
     593  <xsl:apply-templates select="." mode="object.xref.markup">
     594    <xsl:with-param name="purpose" select="'xref'"/>
     595    <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
     596    <xsl:with-param name="referrer" select="$referrer"/>
     597    <xsl:with-param name="verbose" select="$verbose"/>
     598  </xsl:apply-templates>
     599</xsl:template>
     600
    577601<xsl:template match="bridgehead" mode="xref-to">
    578602  <xsl:param name="referrer"/>
     
    602626</xsl:template>
    603627
    604 <xsl:template match="qandadiv" 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="." 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 
    617628<xsl:template match="qandaentry" mode="xref-to">
    618629  <xsl:param name="referrer"/>
     
    620631  <xsl:param name="verbose" select="1"/>
    621632
    622   <xsl:apply-templates select="question[1]" mode="object.xref.markup">
    623     <xsl:with-param name="purpose" select="'xref'"/>
     633  <xsl:apply-templates select="question[1]" mode="xref-to">
    624634    <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
    625635    <xsl:with-param name="referrer" select="$referrer"/>
     
    633643  <xsl:param name="verbose" select="1"/>
    634644
    635   <xsl:apply-templates select="." mode="object.xref.markup">
    636     <xsl:with-param name="purpose" select="'xref'"/>
    637     <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
    638     <xsl:with-param name="referrer" select="$referrer"/>
    639     <xsl:with-param name="verbose" select="$verbose"/>
    640   </xsl:apply-templates>
     645  <xsl:choose>
     646    <xsl:when test="string-length(label) != 0">
     647      <xsl:apply-templates select="." mode="label.markup"/>
     648    </xsl:when>
     649    <xsl:otherwise>
     650      <xsl:apply-templates select="." mode="object.xref.markup">
     651        <xsl:with-param name="purpose" select="'xref'"/>
     652        <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
     653        <xsl:with-param name="referrer" select="$referrer"/>
     654        <xsl:with-param name="verbose" select="$verbose"/>
     655      </xsl:apply-templates>
     656    </xsl:otherwise>
     657  </xsl:choose>
    641658</xsl:template>
    642659
     
    660677  <xsl:choose>
    661678    <xsl:when test="refmeta/refentrytitle">
    662       <xsl:apply-templates select="refmeta/refentrytitle"/>
    663     </xsl:when>
    664     <xsl:otherwise>
    665       <xsl:apply-templates select="refnamediv/refname[1]"/>
    666     </xsl:otherwise>
    667   </xsl:choose>
    668   <xsl:apply-templates select="refmeta/manvolnum"/>
     679      <xsl:apply-templates select="refmeta/refentrytitle" mode="no.anchor.mode"/>
     680    </xsl:when>
     681    <xsl:otherwise>
     682      <xsl:apply-templates select="refnamediv/refname[1]" mode="no.anchor.mode"/>
     683    </xsl:otherwise>
     684  </xsl:choose>
     685  <xsl:apply-templates select="refmeta/manvolnum" mode="no.anchor.mode"/>
    669686</xsl:template>
    670687
     
    712729</xsl:template>
    713730
     731<xsl:template match="primary|secondary|tertiary" mode="xref-to">
     732  <xsl:value-of select="."/>
     733</xsl:template>
     734
     735<xsl:template match="indexterm" mode="xref-to">
     736  <xsl:value-of select="primary"/>
     737</xsl:template>
     738
    714739<xsl:template match="varlistentry/term" mode="xref-to">
    715740  <xsl:param name="referrer"/>
    716741  <xsl:param name="xrefstyle"/>
    717742
    718   <!-- to avoid the comma that will be generated if there are several terms -->
    719   <xsl:apply-templates/>
     743  <xsl:apply-templates mode="no.anchor.mode"/>
    720744</xsl:template>
    721745
     
    751775</xsl:template>
    752776
    753 <xsl:template match="para" mode="xref-to">
    754   <xsl:param name="referrer"/>
    755   <xsl:param name="xrefstyle"/>
    756   <xsl:param name="verbose" select="1"/>
    757 
    758   <xsl:variable name="context" select="(ancestor::simplesect                                        |ancestor::section                                        |ancestor::sect1                                        |ancestor::sect2                                        |ancestor::sect3                                        |ancestor::sect4                                        |ancestor::sect5                                        |ancestor::refsection                                        |ancestor::refsect1                                        |ancestor::refsect2                                        |ancestor::refsect3                                        |ancestor::chapter                                        |ancestor::appendix                                        |ancestor::preface                                        |ancestor::partintro                                        |ancestor::dedication                                        |ancestor::colophon                                        |ancestor::bibliography                                        |ancestor::index                                        |ancestor::glossary                                        |ancestor::glossentry                                        |ancestor::listitem                                        |ancestor::varlistentry)[last()]"/>
    759 
    760   <xsl:apply-templates select="$context" mode="xref-to">
    761     <xsl:with-param name="purpose" select="'xref'"/>
    762     <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
    763     <xsl:with-param name="referrer" select="$referrer"/>
    764     <xsl:with-param name="verbose" select="$verbose"/>
    765   </xsl:apply-templates>
     777<!-- These are elements for which no link text exists, so an xref to one
     778     uses the xrefstyle attribute if specified, or if not it falls back
     779     to the container element's link text -->
     780<xsl:template match="para|phrase|simpara|anchor|quote" mode="xref-to">
     781  <xsl:param name="referrer"/>
     782  <xsl:param name="xrefstyle"/>
     783  <xsl:param name="verbose" select="1"/>
     784
     785  <xsl:variable name="context" select="(ancestor::simplesect                                        |ancestor::section                                        |ancestor::sect1                                        |ancestor::sect2                                        |ancestor::sect3                                        |ancestor::sect4                                        |ancestor::sect5                                        |ancestor::topic                                        |ancestor::refsection                                        |ancestor::refsect1                                        |ancestor::refsect2                                        |ancestor::refsect3                                        |ancestor::chapter                                        |ancestor::appendix                                        |ancestor::preface                                        |ancestor::partintro                                        |ancestor::dedication                                        |ancestor::acknowledgements                                        |ancestor::colophon                                        |ancestor::bibliography                                        |ancestor::index                                        |ancestor::glossary                                        |ancestor::glossentry                                        |ancestor::listitem                                        |ancestor::varlistentry)[last()]"/>
     786
     787  <xsl:choose>
     788    <xsl:when test="$xrefstyle != ''">
     789      <xsl:apply-templates select="." mode="object.xref.markup">
     790        <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
     791        <xsl:with-param name="referrer" select="$referrer"/>
     792        <xsl:with-param name="verbose" select="$verbose"/>
     793      </xsl:apply-templates>
     794    </xsl:when>
     795    <xsl:otherwise>
     796      <xsl:apply-templates select="$context" mode="xref-to">
     797        <xsl:with-param name="purpose" select="'xref'"/>
     798        <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
     799        <xsl:with-param name="referrer" select="$referrer"/>
     800        <xsl:with-param name="verbose" select="$verbose"/>
     801      </xsl:apply-templates>
     802    </xsl:otherwise>
     803  </xsl:choose>
    766804</xsl:template>
    767805
     
    814852    <xsl:choose>
    815853      <xsl:when test="local-name(*[1]) = 'abbrev'">
    816         <xsl:apply-templates select="*[1]"/>
     854        <xsl:apply-templates select="*[1]" mode="no.anchor.mode"/>
    817855      </xsl:when>
    818856      <xsl:otherwise>
     
    862900      <xsl:when test="count(child::node()) &gt; 0">
    863901        <!-- If it has content, use it -->
    864         <xsl:apply-templates/>
     902        <xsl:apply-templates mode="no.anchor.mode"/>
    865903      </xsl:when>
    866904      <!-- else look for an endterm -->
     
    911949  <xsl:variable name="link">
    912950    <a>
    913       <xsl:apply-templates select="." mode="class.attribute"/>
     951      <xsl:apply-templates select="." mode="common.html.attributes"/>
    914952      <xsl:if test="@id or @xml:id">
    915         <xsl:attribute name="id">
    916           <xsl:value-of select="(@id|@xml:id)[1]"/>
    917         </xsl:attribute>
     953        <xsl:choose>
     954          <xsl:when test="$generate.id.attributes = 0">
     955            <xsl:attribute name="id">
     956              <xsl:value-of select="(@id|@xml:id)[1]"/>
     957            </xsl:attribute>
     958          </xsl:when>
     959          <xsl:otherwise>
     960            <xsl:attribute name="id">
     961              <xsl:value-of select="(@id|@xml:id)[1]"/>
     962            </xsl:attribute>
     963          </xsl:otherwise>
     964        </xsl:choose>
    918965      </xsl:if>
    919966      <xsl:attribute name="href"><xsl:value-of select="$url"/></xsl:attribute>
     
    928975        </xsl:when>
    929976        <xsl:otherwise>
    930           <xsl:apply-templates/>
     977          <xsl:apply-templates mode="no.anchor.mode"/>
    931978        </xsl:otherwise>
    932979      </xsl:choose>
     
    949996
    950997  <xsl:call-template name="anchor"/>
    951 
    952   <xsl:variable name="localinfo" select="@localinfo"/>
    953998
    954999  <xsl:choose>
     
    10331078      <xsl:variable name="hottext">
    10341079        <xsl:choose>
    1035           <xsl:when test="$content">
     1080          <xsl:when test="string-length($content) != 0">
    10361081            <xsl:copy-of select="$content"/>
    10371082          </xsl:when>
     
    10651110        <xsl:when test="$href != ''">
    10661111          <a href="{$href}">
    1067             <xsl:apply-templates select="." mode="class.attribute"/>
     1112            <xsl:apply-templates select="." mode="common.html.attributes"/>
     1113            <xsl:call-template name="id.attribute"/>
    10681114            <xsl:copy-of select="$hottext"/>
    10691115          </a>
     
    10721118        </xsl:when>
    10731119        <xsl:otherwise>
    1074           <span class="olink"><xsl:copy-of select="$hottext"/></span>
     1120          <span class="olink">
     1121            <xsl:call-template name="id.attribute"/>
     1122            <xsl:copy-of select="$hottext"/>
     1123          </span>
    10751124          <xsl:copy-of select="$olink.page.citation"/>
    10761125          <xsl:copy-of select="$olink.docname.citation"/>
     
    10801129    </xsl:when>
    10811130
    1082     <!-- Or use old olink mechanism -->
    1083     <xsl:otherwise>
    1084       <xsl:variable name="href">
    1085         <xsl:choose>
    1086           <xsl:when test="@linkmode">
    1087             <!-- use the linkmode to get the base URI, use localinfo as fragid -->
    1088             <xsl:variable name="modespec" select="key('id',@linkmode)"/>
    1089             <xsl:if test="count($modespec) != 1                           or local-name($modespec) != 'modespec'">
    1090               <xsl:message>Warning: olink linkmode pointer is wrong.</xsl:message>
    1091             </xsl:if>
    1092             <xsl:value-of select="$modespec"/>
    1093             <xsl:if test="@localinfo">
    1094               <xsl:text>#</xsl:text>
    1095               <xsl:value-of select="@localinfo"/>
    1096             </xsl:if>
    1097           </xsl:when>
    1098           <xsl:when test="@type = 'href'">
    1099             <xsl:call-template name="olink.outline">
    1100               <xsl:with-param name="outline.base.uri" select="unparsed-entity-uri(@targetdocent)"/>
    1101               <xsl:with-param name="localinfo" select="@localinfo"/>
    1102               <xsl:with-param name="return" select="'href'"/>
    1103             </xsl:call-template>
    1104           </xsl:when>
    1105           <xsl:otherwise>
    1106             <xsl:value-of select="$olink.resolver"/>
    1107             <xsl:text>?</xsl:text>
    1108             <xsl:value-of select="$olink.sysid"/>
    1109             <xsl:value-of select="unparsed-entity-uri(@targetdocent)"/>
    1110             <!-- XSL gives no access to the public identifier (grumble...) -->
    1111             <xsl:if test="@localinfo">
    1112               <xsl:text>&amp;</xsl:text>
    1113               <xsl:value-of select="$olink.fragid"/>
    1114               <xsl:value-of select="@localinfo"/>
    1115             </xsl:if>
    1116           </xsl:otherwise>
    1117         </xsl:choose>
    1118       </xsl:variable>
    1119    
     1131    <xsl:otherwise>
    11201132      <xsl:choose>
    1121         <xsl:when test="$href != ''">
    1122           <a href="{$href}">
    1123             <xsl:apply-templates select="." mode="class.attribute"/>
    1124             <xsl:call-template name="olink.hottext"/>
    1125           </a>
     1133        <xsl:when test="@linkmode or @targetdocent or @localinfo">
     1134          <!-- old olink mechanism -->
     1135          <xsl:message>
     1136            <xsl:text>ERROR: olink using obsolete attributes </xsl:text>
     1137            <xsl:text>@linkmode, @targetdocent, @localinfo are </xsl:text>
     1138            <xsl:text>not supported.</xsl:text>
     1139          </xsl:message>
    11261140        </xsl:when>
    11271141        <xsl:otherwise>
    1128           <xsl:call-template name="olink.hottext"/>
     1142          <xsl:message>
     1143            <xsl:text>ERROR: olink is missing linking attributes.</xsl:text>
     1144          </xsl:message>
    11291145        </xsl:otherwise>
    11301146      </xsl:choose>
     
    11351151<xsl:template match="*" mode="pagenumber.markup">
    11361152  <!-- no-op in HTML -->
    1137 </xsl:template>
    1138 
    1139 
    1140 <xsl:template name="olink.outline">
    1141   <xsl:param name="outline.base.uri"/>
    1142   <xsl:param name="localinfo"/>
    1143   <xsl:param name="return" select="href"/>
    1144 
    1145   <xsl:variable name="outline-file" select="concat($outline.base.uri,                                $olink.outline.ext)"/>
    1146 
    1147   <xsl:variable name="outline" select="document($outline-file,.)/div"/>
    1148 
    1149   <xsl:variable name="node-href">
    1150     <xsl:choose>
    1151       <xsl:when test="$localinfo != ''">
    1152         <xsl:variable name="node" select="$outline//                                    *[@id=$localinfo or @xml:id=$localinfo]"/>
    1153         <xsl:value-of select="$node/@href"/>
    1154       </xsl:when>
    1155       <xsl:otherwise>
    1156         <xsl:value-of select="$outline/@href"/>
    1157       </xsl:otherwise>
    1158     </xsl:choose>
    1159   </xsl:variable>
    1160 
    1161   <xsl:variable name="node-xref">
    1162     <xsl:choose>
    1163       <xsl:when test="$localinfo != ''">
    1164         <xsl:variable name="node" select="$outline//                                *[@id=$localinfo or @xml:id=$localinfo]"/>
    1165         <xsl:copy-of select="$node/xref"/>
    1166       </xsl:when>
    1167       <xsl:otherwise>
    1168         <xsl:value-of select="$outline/xref"/>
    1169       </xsl:otherwise>
    1170     </xsl:choose>
    1171   </xsl:variable>
    1172 
    1173   <xsl:choose>
    1174     <xsl:when test="$return = 'href'">
    1175       <xsl:value-of select="$node-href"/>
    1176     </xsl:when>
    1177     <xsl:when test="$return = 'xref'">
    1178       <xsl:value-of select="$node-xref"/>
    1179     </xsl:when>
    1180     <xsl:otherwise>
    1181       <xsl:copy-of select="$node-xref"/>
    1182     </xsl:otherwise>
    1183   </xsl:choose>
    11841153</xsl:template>
    11851154
     
    11971166
    11981167<xsl:template match="title" mode="xref">
    1199   <xsl:apply-templates/>
     1168  <xsl:apply-templates mode="no.anchor.mode"/>
    12001169</xsl:template>
    12011170
     
    12161185
    12171186  <xsl:choose>
    1218     <!-- FIXME: what about the case where titleabbrev is inside the info? -->
    1219     <xsl:when test="$purpose = 'xref' and titleabbrev">
    1220       <xsl:apply-templates select="." mode="titleabbrev.markup"/>
     1187    <xsl:when test="$purpose = 'xref'">
     1188      <xsl:copy-of select="$title"/>
    12211189    </xsl:when>
    12221190    <xsl:otherwise>
     
    12331201  <xsl:choose>
    12341202    <xsl:when test="$purpose = 'xref'">
    1235       <i>
     1203      <em xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
    12361204        <xsl:copy-of select="$title"/>
    1237       </i>
     1205      </em>
    12381206    </xsl:when>
    12391207    <xsl:otherwise>
Note: See TracChangeset for help on using the changeset viewer.