Author: manuel Date: 2007-04-15 15:44:45 -0600 (Sun, 15 Apr 2007) New Revision: 8054
Modified: branches/new-xsl/xhtml/lfs-navigational.xsl Log: Skip dummy sect1 from navigational links. Modified: branches/new-xsl/xhtml/lfs-navigational.xsl =================================================================== --- branches/new-xsl/xhtml/lfs-navigational.xsl 2007-04-15 21:44:03 UTC (rev 8053) +++ branches/new-xsl/xhtml/lfs-navigational.xsl 2007-04-15 21:44:45 UTC (rev 8054) @@ -89,8 +89,9 @@ Added a title attribute to the link containing the target title (it content is displayed when placing the mouse over the link) For "Prev" and "Next" links, added the target title under it. - When "Next" target is the Index, added gettext support for the - Index title. --> + When "Next" target is the Index, added gentext support for the + Index title. + Skip links to dummy sect1. --> <xsl:template name="navigational.links"> <xsl:param name="prev"/> <xsl:param name="next"/> @@ -99,60 +100,142 @@ <ul> <xsl:if test="count($prev)>0 and $prev != $home"> <li class="prev"> - <a accesskey="p"> - <xsl:attribute name="href"> - <xsl:call-template name="href.target"> - <xsl:with-param name="object" select="$prev"/> - </xsl:call-template> - </xsl:attribute> - <xsl:attribute name="title"> - <xsl:value-of select="$prev/title"/> - </xsl:attribute> - <xsl:call-template name="navig.content"> - <xsl:with-param name="direction" select="'prev'"/> - </xsl:call-template> - </a> - <p> - <xsl:value-of select="$prev/title"/> - </p> + <xsl:choose> + <xsl:when test="[EMAIL PROTECTED]'dummy'] and + count(preceding-sibling::sect1)=1"> + <a accesskey="p"> + <xsl:attribute name="href"> + <xsl:call-template name="href.target"> + <xsl:with-param name="object" select=".."/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="title"> + <xsl:value-of select="../title"/> + </xsl:attribute> + <xsl:call-template name="navig.content"> + <xsl:with-param name="direction" select="'prev'"/> + </xsl:call-template> + </a> + <p> + <xsl:value-of select="../title"/> + </p> + </xsl:when> + <xsl:when test="[EMAIL PROTECTED]'dummy'] and + count(preceding-sibling::sect1)>1"> + <a accesskey="p"> + <xsl:attribute name="href"> + <xsl:call-template name="href.target"> + <xsl:with-param name="object" select="preceding-sibling::sect1[position()=2]"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="title"> + <xsl:value-of select="preceding-sibling::sect1[position()=2]/title"/> + </xsl:attribute> + <xsl:call-template name="navig.content"> + <xsl:with-param name="direction" select="'prev'"/> + </xsl:call-template> + </a> + <p> + <xsl:value-of select="preceding-sibling::sect1[position()=2]/title"/> + </p> + </xsl:when> + <xsl:otherwise> + <a accesskey="p"> + <xsl:attribute name="href"> + <xsl:call-template name="href.target"> + <xsl:with-param name="object" select="$prev"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="title"> + <xsl:value-of select="$prev/title"/> + </xsl:attribute> + <xsl:call-template name="navig.content"> + <xsl:with-param name="direction" select="'prev'"/> + </xsl:call-template> + </a> + <p> + <xsl:value-of select="$prev/title"/> + </p> + </xsl:otherwise> + </xsl:choose> </li> </xsl:if> <xsl:if test="count($next)>0"> <li class="next"> - <a accesskey="n"> - <xsl:attribute name="href"> - <xsl:call-template name="href.target"> - <xsl:with-param name="object" select="$next"/> - </xsl:call-template> - </xsl:attribute> - <xsl:attribute name="title"> - <xsl:choose> - <xsl:when test="local-name($next)='index'"> - <xsl:call-template name="gentext"> - <xsl:with-param name="key">Index</xsl:with-param> + <xsl:choose> + <xsl:when test="[EMAIL PROTECTED]'dummy'] and local-name(.) = 'sect1'"> + <a accesskey="n"> + <xsl:attribute name="href"> + <xsl:call-template name="href.target"> + <xsl:with-param name="object" select="following-sibling::sect1[position()=2]"/> </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="$next/title"/> - </xsl:otherwise> - </xsl:choose> - </xsl:attribute> - <xsl:call-template name="navig.content"> - <xsl:with-param name="direction" select="'next'"/> - </xsl:call-template> - </a> - <p> - <xsl:choose> - <xsl:when test="local-name($next)='index'"> - <xsl:call-template name="gentext"> - <xsl:with-param name="key">Index</xsl:with-param> + </xsl:attribute> + <xsl:attribute name="title"> + <xsl:value-of select="following-sibling::sect1[position()=2]/title"/> + </xsl:attribute> + <xsl:call-template name="navig.content"> + <xsl:with-param name="direction" select="'next'"/> </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="$next/title"/> - </xsl:otherwise> - </xsl:choose> - </p> + </a> + <p> + <xsl:value-of select="following-sibling::sect1[position()=2]/title"/> + </p> + </xsl:when> + <xsl:when test="[EMAIL PROTECTED]'dummy'] and local-name(.) = 'chapter'"> + <a accesskey="n"> + <xsl:attribute name="href"> + <xsl:call-template name="href.target"> + <xsl:with-param name="object" select="descendant::sect1[position()=2]"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="title"> + <xsl:value-of select="descendant::sect1[position()=2]/title"/> + </xsl:attribute> + <xsl:call-template name="navig.content"> + <xsl:with-param name="direction" select="'next'"/> + </xsl:call-template> + </a> + <p> + <xsl:value-of select="descendant::sect1[position()=2]/title"/> + </p> + </xsl:when> + <xsl:otherwise> + <a accesskey="n"> + <xsl:attribute name="href"> + <xsl:call-template name="href.target"> + <xsl:with-param name="object" select="$next"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="title"> + <xsl:choose> + <xsl:when test="local-name($next)='index'"> + <xsl:call-template name="gentext"> + <xsl:with-param name="key">Index</xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$next/title"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:call-template name="navig.content"> + <xsl:with-param name="direction" select="'next'"/> + </xsl:call-template> + </a> + <p> + <xsl:choose> + <xsl:when test="local-name($next)='index'"> + <xsl:call-template name="gentext"> + <xsl:with-param name="key">Index</xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$next/title"/> + </xsl:otherwise> + </xsl:choose> + </p> + </xsl:otherwise> + </xsl:choose> </li> </xsl:if> <li class="up"> -- http://linuxfromscratch.org/mailman/listinfo/lfs-book FAQ: http://www.linuxfromscratch.org/lfs/faq.html Unsubscribe: See the above information page