Author: manuel Date: 2007-03-30 13:30:28 -0600 (Fri, 30 Mar 2007) New Revision: 7990
Modified: branches/new-xsl/xhtml/lfs-index.xsl Log: Revised xhtml/lfs-index.xsl Modified: branches/new-xsl/xhtml/lfs-index.xsl =================================================================== --- branches/new-xsl/xhtml/lfs-index.xsl 2007-03-29 20:37:25 UTC (rev 7989) +++ branches/new-xsl/xhtml/lfs-index.xsl 2007-03-30 19:30:28 UTC (rev 7990) @@ -3,15 +3,24 @@ <!ENTITY lowercase "'AaÀàÁáÂâÃãÄäÅåĀāĂ㥹ǍǎǞǟǠǡǺǻȀȁȂȃȦȧḀḁẚẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặBbƀƁɓƂƃḂḃḄḅḆḇCcÇçĆćĈĉĊċČčƇƈɕḈḉDdĎďĐđƊɗƋƌDžDzȡɖḊḋḌḍḎḏḐḑḒḓEeÈèÉéÊêËëĒēĔĕĖėĘęĚěȄȅȆȇȨȩḔḕḖḗḘḙḚḛḜḝẸẹẺẻẼẽẾế& #7872;ềỂểỄễỆệFfƑƒḞḟGgĜĝĞğĠġĢģƓɠǤǥǦǧǴǵḠḡHhĤĥĦħȞȟɦḢḣḤḥḦḧḨḩḪḫẖIiÌìÍíÎîÏïĨĩĪīĬĭĮįİƗɨǏǐȈȉȊȋḬḭḮḯỈỉỊịJjĴĵǰʝKkĶķƘƙǨǩḰḱḲḳḴḵLlĹĺĻļĽľĿŀŁłƚLjȴɫɬɭḶḷḸḹḺḻḼḽMmɱḾḿṀṁṂṃNnÑñŃńŅņŇňƝɲƞȠNjǸǹȵɳṄṅṆṇṈṉṊ&# 7755;OoÒòÓóÔôÕõÖöØøŌōŎŏŐőƟƠơǑǒǪǫǬǭǾǿȌȍȎȏȪȫȬȭȮȯȰȱṌṍṎṏṐṑṒṓỌọỎỏỐốỒồỔổỖỗỘộỚớỜờỞởỠỡỢợPpƤƥṔṕṖṗQqʠRrŔŕŖŗŘřȐȑȒȓɼɽɾṘṙṚṛṜṝṞṟSsŚśŜŝŞşŠšȘșʂṠṡṢṣṤṥṦṧṨṩTtŢţŤťŦŧƫƬƭƮʈȚțȶṪṫṬṭṮṯṰṱẗUuÙùÚúÛû& #220;üŨũŪūŬŭŮůŰűŲųƯưǓǔǕǖǗǘǙǚǛǜȔȕȖȗṲṳṴṵṶṷṸṹṺṻỤụỦủỨứỪừỬửỮữỰựVvƲʋṼṽṾṿWwŴŵẀẁẂẃẄẅẆẇẈẉẘXxẊẋẌẍYyÝýÿŸŶŷƳƴȲȳẎẏẙỲỳỴỵỶỷỸỹZzŹźŻżŽžƵƶȤȥʐʑẐẑẒẓẔẕẕ'"> <!ENTITY uppercase "'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEFFFFFFGGGGGGGGGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIJJJJJJKKKKKKKKKKKKKKLLLLLLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMNNNNNNNNNNNNNNNNNNNNNNNNNNNOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOPPPPPPPPQQQRRRRRRRRRRRRRRRRRRRRRRRSSSSSSSSSSSSSSSSSSSSSSSTTTTTTTTTTTTTTTTTTTTTTTTTUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUVVVVVVVVWWWWWWWWWWWWWWWXXXXXXYYYYYYYYYYYYYYYYYYYYYYYZZZZZZZZZZZZZZZZZZZZZ'"> <!ENTITY primary 'normalize-space(concat(primary/@sortas, primary[not(@sortas) or @sortas = ""]))'> +<!ENTITY secondary 'normalize-space(concat(secondary/@sortas, secondary[not(@sortas) or @sortas = ""]))'> <!ENTITY scope "count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))"> +<!ENTITY section "(ancestor-or-self::set |ancestor-or-self::book |ancestor-or-self::part |ancestor-or-self::reference |ancestor-or-self::partintro |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface |ancestor-or-self::article |ancestor-or-self::section |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3 |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::refentry |ancestor-or-self::refsect1 |ancestor-or-self::refsect2 |ancestor-or-self::refsect3 |ancestor-or-self::simplesect |ancestor-or-self::bibliography |ancestor-or-self::glossary |ancestor-or-self::index |ancestor-or-self::webpage)[last()]"> +<!ENTITY section.id "generate-id(§ion;)"> +<!ENTITY sep '" "'> ]> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0"> - <!-- This stylesheet controls how the Index is generated --> + <!-- REVISED --> + <!-- This stylesheet controls how the Index is generated. + Due how they are created, the original XHTML stylesheets don't make + use of the entities from {docbook-xsl}/common/entities.ent. + We add the relevant ones in the DOCTYPE to have more readable templates. --> + <!-- Should the Index be generated? 1 = yes, 0 = no --> <xsl:param name="generate.index" select="1"></xsl:param> @@ -53,7 +62,12 @@ </div> </xsl:template> - <!--Divisions--> + <!--Divisions: + Translate alphabetical divisons titles to by-type titles. + Added gettext support to divisions titles. + Using h2 for divisions titles. + Changed output from dl format to ul format. --> + <!-- The original template is in {docbook-xsl}/xhtml/autoidx.xsl --> <xsl:template match="indexterm" mode="index-div-basic"> <xsl:param name="scope" select="."/> <xsl:param name="role" select="''"/> @@ -98,8 +112,8 @@ </h2> </xsl:if> <ul> - <xsl:apply-templates select="key('letter', $key)[&scope;] - [count(.|key('primary', &primary;)[&scope;][1])=1]" mode="index-primary"> + <xsl:apply-templates select="key('letter', $key)[&scope;] [count(.|key('primary', &primary;)[&scope;][1])=1]" + mode="index-primary"> <xsl:with-param name="scope" select="$scope"/> <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/> </xsl:apply-templates> @@ -108,16 +122,28 @@ </xsl:if> </xsl:template> - <!-- Dropping the separator from here--> + <!-- Dropping $term.separator and $number.separator from here. + We add our customized ones in the output flow. + As all our indexterm have @zone attributes, removed a lot of + unused code. --> + <!-- The original template is in {docbook-xsl}/xhtml/autoidx.xsl --> <xsl:template match="indexterm" mode="reference"> <xsl:param name="scope" select="."/> - <xsl:call-template name="reference"> - <xsl:with-param name="zones" select="normalize-space(@zone)"/> - <xsl:with-param name="scope" select="$scope"/> - </xsl:call-template> + <xsl:param name="role" select="''"/> + <xsl:param name="type" select="''"/> + <xsl:call-template name="reference"> + <xsl:with-param name="zones" select="normalize-space(@zone)"/> + <xsl:with-param name="scope" select="$scope"/> + <xsl:with-param name="role" select="$role"/> + <xsl:with-param name="type" select="$type"/> + </xsl:call-template> </xsl:template> - <!-- Changing the output tags and re-addind the separator--> + <!-- Primary items: + Changed the output format from dl to ul. + Placed the term and separator into strong tags. + Removed code for unused see and sealso childs. --> + <!-- The original template is in {docbook-xsl}/xhtml/autoidx.xsl --> <xsl:template match="indexterm" mode="index-primary"> <xsl:param name="scope" select="."/> <xsl:param name="role" select="''"/> @@ -129,54 +155,59 @@ <xsl:value-of select="primary"/> <xsl:text>: </xsl:text> </strong> - <xsl:for-each select="$refs[generate-id() = generate-id(key('primary-section', - concat($key, " ", generate-id((ancestor-or-self::book |ancestor-or-self::part - |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface - |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3 - |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::index)[last()])))[&scope;][1])]"> + <xsl:for-each select="$refs[generate-id() = generate-id(key('primary-section',concat($key, &sep;, §ion.id;))[&scope;][1])]"> <xsl:apply-templates select="." mode="reference"> <xsl:with-param name="scope" select="$scope"/> + <xsl:with-param name="role" select="$role"/> + <xsl:with-param name="type" select="$type"/> </xsl:apply-templates> </xsl:for-each> <xsl:if test="$refs/secondary"> <ul> - <xsl:apply-templates select="$refs[secondary and count(.|key('secondary', - concat($key, " ", normalize-space(concat(secondary/@sortas, - secondary[not(@sortas)]))))[&scope;][1]) = 1]" mode="index-secondary"> + <xsl:apply-templates select="$refs[secondary and count(.|key('secondary', concat($key, &sep;, &secondary;))[&scope;][1]) = 1]" + mode="index-secondary"> <xsl:with-param name="scope" select="$scope"/> - <xsl:sort select="translate(normalize-space(concat(secondary/@sortas, - secondary[not(@sortas)])), &lowercase;, &uppercase;)"/> + <xsl:with-param name="role" select="$role"/> + <xsl:with-param name="type" select="$type"/> + <xsl:sort select="translate(&secondary;, &lowercase;, &uppercase;)"/> </xsl:apply-templates> </ul> </xsl:if> </li> </xsl:template> + <!-- Secondary items: + Changed the output format from dl to ul. + Placed the term and separator into strong tags. + Removed code for unused tertiary, see, and sealso childs. --> + <!-- The original template is in {docbook-xsl}/xhtml/autoidx.xsl --> <xsl:template match="indexterm" mode="index-secondary"> <xsl:param name="scope" select="."/> <xsl:param name="role" select="''"/> <xsl:param name="type" select="''"/> - <xsl:variable name="key" select="concat(&primary;, " ", - normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])))"/> + <xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;)"/> <xsl:variable name="refs" select="key('secondary', $key)[&scope;]"/> <li> <strong class="secitem"> <xsl:value-of select="secondary"/> <xsl:text>: </xsl:text> </strong> - <xsl:for-each select="$refs[generate-id() = generate-id(key('secondary-section', - concat($key, " ", generate-id((ancestor-or-self::book |ancestor-or-self::part - |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface - |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3 - |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::index)[last()])))[&scope;][1])]"> + <xsl:for-each select="$refs[generate-id() = generate-id(key('secondary-section', concat($key, &sep;, §ion.id;))[&scope;][1])]"> <xsl:apply-templates select="." mode="reference"> <xsl:with-param name="scope" select="$scope"/> + <xsl:with-param name="role" select="$role"/> + <xsl:with-param name="type" select="$type"/> </xsl:apply-templates> </xsl:for-each> </li> </xsl:template> - <!--Links (This template also fix a bug in the original code)--> + <!-- The target links: + Changed links separator. + On the cecond @zone link, we use a fixed string for the text + with gettext support. + Assume that there is no more than 2 @zone in a indexentry. --> + <!-- The original template is in {docbook-xsl}/xhtml/autoidx.xsl --> <xsl:template name="reference"> <xsl:param name="scope" select="."/> <xsl:param name="role" select="''"/> @@ -190,8 +221,9 @@ <xsl:variable name="target2" select="key('sections', $zone2)[&scope;]"/> <a> <xsl:attribute name="href"> - <xsl:call-template name="href.target.uri"> + <xsl:call-template name="href.target"> <xsl:with-param name="object" select="$target[1]"/> + <xsl:with-param name="context" select="//index[&scope;][1]"/> </xsl:call-template> </xsl:attribute> <xsl:apply-templates select="$target[1]" mode="index-title-content"/> @@ -199,8 +231,9 @@ <xsl:text> -- </xsl:text> <a> <xsl:attribute name="href"> - <xsl:call-template name="href.target.uri"> + <xsl:call-template name="href.target"> <xsl:with-param name="object" select="$target2[1]"/> + <xsl:with-param name="context" select="//index[&scope;][1]"/> </xsl:call-template> </xsl:attribute> <xsl:call-template name="gentext"> @@ -213,8 +246,9 @@ <xsl:variable name="target" select="key('sections', $zone)[&scope;]"/> <a> <xsl:attribute name="href"> - <xsl:call-template name="href.target.uri"> + <xsl:call-template name="href.target"> <xsl:with-param name="object" select="$target[1]"/> + <xsl:with-param name="context" select="//index[&scope;][1]"/> </xsl:call-template> </xsl:attribute> <xsl:apply-templates select="$target[1]" mode="index-title-content"/> @@ -224,6 +258,7 @@ </xsl:template> <!-- Dropping unneeded anchors --> + <!-- The original template is in {docbook-xsl}/xhtml/index.xsl --> <xsl:template match="indexterm"/> </xsl:stylesheet> -- http://linuxfromscratch.org/mailman/listinfo/lfs-book FAQ: http://www.linuxfromscratch.org/lfs/faq.html Unsubscribe: See the above information page
