- Timestamp:
- 12/10/2013 11:37:38 PM (11 years ago)
- Branches:
- 7.5-systemd, 7.6-systemd, 7.7-systemd, 7.8-systemd, 7.9-systemd
- Children:
- 112db9d
- Parents:
- f2a5108
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
stylesheets/lfs-xsl/docbook-xsl-1.78.1/xhtml/xref.xsl
rf2a5108 rb1a51ac1 5 5 6 6 <!-- ******************************************************************** 7 $Id $7 $Id: xref.xsl 9713 2013-01-22 22:08:30Z bobstayton $ 8 8 ******************************************************************** 9 9 … … 20 20 21 21 <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> 23 32 </xsl:template> 24 33 … … 152 161 </xsl:message> 153 162 <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"/> 155 165 <xsl:text>???</xsl:text> 156 166 </a> … … 158 168 <xsl:otherwise> 159 169 <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"/> 161 172 <xsl:apply-templates select="$etarget" mode="endterm"/> 162 173 </a> … … 167 178 <xsl:when test="$target/@xreflabel"> 168 179 <a> 169 <xsl:apply-templates select="." mode="c lass.attribute"/>180 <xsl:apply-templates select="." mode="common.html.attributes"/> 170 181 <xsl:attribute name="href"> 171 182 <xsl:call-template name="href.target"> … … 192 203 <a href="{$href}"> 193 204 <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"> 195 206 <xsl:attribute name="title"> 196 207 <xsl:apply-templates select="$target" mode="xref-title"/> … … 224 235 <!-- Process the children of the endterm element --> 225 236 <xsl:variable name="endterm"> 226 <xsl:apply-templates select="child::node()" />237 <xsl:apply-templates select="child::node()" mode="no.anchor.mode"/> 227 238 </xsl:variable> 228 239 229 240 <xsl:choose> 230 <xsl:when test=" function-available('exsl:node-set')">241 <xsl:when test="$exsl.node.set.available != 0"> 231 242 <xsl:apply-templates select="exsl:node-set($endterm)" mode="remove-ids"/> 232 243 </xsl:when> … … 328 339 </xsl:template> 329 340 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|s egmentedlist |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"> 331 342 <xsl:param name="referrer"/> 332 343 <xsl:param name="xrefstyle"/> … … 403 414 </xsl:template> 404 415 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"> 406 417 <xsl:param name="referrer"/> 407 418 <xsl:param name="xrefstyle"/> … … 455 466 </xsl:when> 456 467 <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"/> 458 469 </xsl:when> 459 470 <xsl:otherwise> … … 479 490 </xsl:when> 480 491 <xsl:when test="local-name(*[1]) = 'abbrev'"> 481 <xsl:apply-templates select="*[1]" />492 <xsl:apply-templates select="*[1]" mode="no.anchor.mode"/> 482 493 </xsl:when> 483 494 <xsl:otherwise> … … 510 521 <xsl:choose> 511 522 <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"/> 513 524 </xsl:when> 514 525 <xsl:otherwise> … … 531 542 </xsl:template> 532 543 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"/> 535 546 </xsl:template> 536 547 … … 575 586 </xsl:template> 576 587 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 577 601 <xsl:template match="bridgehead" mode="xref-to"> 578 602 <xsl:param name="referrer"/> … … 602 626 </xsl:template> 603 627 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 617 628 <xsl:template match="qandaentry" mode="xref-to"> 618 629 <xsl:param name="referrer"/> … … 620 631 <xsl:param name="verbose" select="1"/> 621 632 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"> 624 634 <xsl:with-param name="xrefstyle" select="$xrefstyle"/> 625 635 <xsl:with-param name="referrer" select="$referrer"/> … … 633 643 <xsl:param name="verbose" select="1"/> 634 644 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> 641 658 </xsl:template> 642 659 … … 660 677 <xsl:choose> 661 678 <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"/> 669 686 </xsl:template> 670 687 … … 712 729 </xsl:template> 713 730 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 714 739 <xsl:template match="varlistentry/term" mode="xref-to"> 715 740 <xsl:param name="referrer"/> 716 741 <xsl:param name="xrefstyle"/> 717 742 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"/> 720 744 </xsl:template> 721 745 … … 751 775 </xsl:template> 752 776 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> 766 804 </xsl:template> 767 805 … … 814 852 <xsl:choose> 815 853 <xsl:when test="local-name(*[1]) = 'abbrev'"> 816 <xsl:apply-templates select="*[1]" />854 <xsl:apply-templates select="*[1]" mode="no.anchor.mode"/> 817 855 </xsl:when> 818 856 <xsl:otherwise> … … 862 900 <xsl:when test="count(child::node()) > 0"> 863 901 <!-- If it has content, use it --> 864 <xsl:apply-templates />902 <xsl:apply-templates mode="no.anchor.mode"/> 865 903 </xsl:when> 866 904 <!-- else look for an endterm --> … … 911 949 <xsl:variable name="link"> 912 950 <a> 913 <xsl:apply-templates select="." mode="c lass.attribute"/>951 <xsl:apply-templates select="." mode="common.html.attributes"/> 914 952 <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> 918 965 </xsl:if> 919 966 <xsl:attribute name="href"><xsl:value-of select="$url"/></xsl:attribute> … … 928 975 </xsl:when> 929 976 <xsl:otherwise> 930 <xsl:apply-templates />977 <xsl:apply-templates mode="no.anchor.mode"/> 931 978 </xsl:otherwise> 932 979 </xsl:choose> … … 949 996 950 997 <xsl:call-template name="anchor"/> 951 952 <xsl:variable name="localinfo" select="@localinfo"/>953 998 954 999 <xsl:choose> … … 1033 1078 <xsl:variable name="hottext"> 1034 1079 <xsl:choose> 1035 <xsl:when test=" $content">1080 <xsl:when test="string-length($content) != 0"> 1036 1081 <xsl:copy-of select="$content"/> 1037 1082 </xsl:when> … … 1065 1110 <xsl:when test="$href != ''"> 1066 1111 <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"/> 1068 1114 <xsl:copy-of select="$hottext"/> 1069 1115 </a> … … 1072 1118 </xsl:when> 1073 1119 <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> 1075 1124 <xsl:copy-of select="$olink.page.citation"/> 1076 1125 <xsl:copy-of select="$olink.docname.citation"/> … … 1080 1129 </xsl:when> 1081 1130 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>&</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> 1120 1132 <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> 1126 1140 </xsl:when> 1127 1141 <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> 1129 1145 </xsl:otherwise> 1130 1146 </xsl:choose> … … 1135 1151 <xsl:template match="*" mode="pagenumber.markup"> 1136 1152 <!-- 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>1184 1153 </xsl:template> 1185 1154 … … 1197 1166 1198 1167 <xsl:template match="title" mode="xref"> 1199 <xsl:apply-templates />1168 <xsl:apply-templates mode="no.anchor.mode"/> 1200 1169 </xsl:template> 1201 1170 … … 1216 1185 1217 1186 <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"/> 1221 1189 </xsl:when> 1222 1190 <xsl:otherwise> … … 1233 1201 <xsl:choose> 1234 1202 <xsl:when test="$purpose = 'xref'"> 1235 < i>1203 <em xmlns:xslo="http://www.w3.org/1999/XSL/Transform"> 1236 1204 <xsl:copy-of select="$title"/> 1237 </ i>1205 </em> 1238 1206 </xsl:when> 1239 1207 <xsl:otherwise>
Note:
See TracChangeset
for help on using the changeset viewer.