From: Norman W. <nw...@us...> - 2002-05-12 11:49:58
|
Update of /cvsroot/docbook/website/xsl In directory usw-pr-cvs1:/tmp/cvs-serv16817 Modified Files: head.xsl website-common.xsl Log Message: Output LINK elements in the HEAD for prev/next/up/first/last/etc. (works great in Mozilla 1.0CR1) Index: head.xsl =================================================================== RCS file: /cvsroot/docbook/website/xsl/head.xsl,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** head.xsl 26 Apr 2002 16:45:28 -0000 1.3 --- head.xsl 12 May 2002 11:49:55 -0000 1.4 *************** *** 16,19 **** --- 16,133 ---- </link> </xsl:if> + + <xsl:variable name="thisid" select="ancestor-or-self::webpage/@id"/> + <xsl:variable name="thisrelpath"> + <xsl:apply-templates select="$autolayout//*[@id=$thisid]" mode="toc-rel-path"/> + </xsl:variable> + + <xsl:variable name="topid"> + <xsl:call-template name="top.page"/> + </xsl:variable> + + <xsl:if test="$topid != ''"> + <link rel="home"> + <xsl:attribute name="href"> + <xsl:call-template name="page.uri"> + <xsl:with-param name="page" select="$autolayout//*[@id=$topid]"/> + <xsl:with-param name="relpath" select="$thisrelpath"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="title"> + <xsl:value-of select="$autolayout//*[@id=$topid]/title"/> + </xsl:attribute> + </link> + </xsl:if> + + <xsl:variable name="upid"> + <xsl:call-template name="up.page"/> + </xsl:variable> + + <xsl:if test="$upid != ''"> + <link rel="up"> + <xsl:attribute name="href"> + <xsl:call-template name="page.uri"> + <xsl:with-param name="page" select="$autolayout//*[@id=$upid]"/> + <xsl:with-param name="relpath" select="$thisrelpath"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="title"> + <xsl:value-of select="$autolayout//*[@id=$upid]/title"/> + </xsl:attribute> + </link> + </xsl:if> + + <xsl:variable name="previd"> + <xsl:call-template name="prev.page"/> + </xsl:variable> + + <xsl:if test="$previd != ''"> + <link rel="previous"> + <xsl:attribute name="href"> + <xsl:call-template name="page.uri"> + <xsl:with-param name="page" select="$autolayout//*[@id=$previd]"/> + <xsl:with-param name="relpath" select="$thisrelpath"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="title"> + <xsl:value-of select="$autolayout//*[@id=$previd]/title"/> + </xsl:attribute> + </link> + </xsl:if> + + <xsl:variable name="nextid"> + <xsl:call-template name="next.page"/> + </xsl:variable> + + <xsl:if test="$nextid != ''"> + <link rel="next"> + <xsl:attribute name="href"> + <xsl:call-template name="page.uri"> + <xsl:with-param name="page" select="$autolayout//*[@id=$nextid]"/> + <xsl:with-param name="relpath" select="$thisrelpath"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="title"> + <xsl:value-of select="$autolayout//*[@id=$nextid]/title"/> + </xsl:attribute> + </link> + </xsl:if> + + <xsl:variable name="firstid"> + <xsl:call-template name="first.page"/> + </xsl:variable> + + <xsl:if test="$firstid != ''"> + <link rel="first"> + <xsl:attribute name="href"> + <xsl:call-template name="page.uri"> + <xsl:with-param name="page" select="$autolayout//*[@id=$firstid]"/> + <xsl:with-param name="relpath" select="$thisrelpath"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="title"> + <xsl:value-of select="$autolayout//*[@id=$firstid]/title"/> + </xsl:attribute> + </link> + </xsl:if> + + <xsl:variable name="lastid"> + <xsl:call-template name="last.page"/> + </xsl:variable> + + <xsl:if test="$lastid != ''"> + <link rel="last"> + <xsl:attribute name="href"> + <xsl:call-template name="page.uri"> + <xsl:with-param name="page" select="$autolayout//*[@id=$lastid]"/> + <xsl:with-param name="relpath" select="$thisrelpath"/> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="title"> + <xsl:value-of select="$autolayout//*[@id=$lastid]/title"/> + </xsl:attribute> + </link> + </xsl:if> + <xsl:apply-templates select="$autolayout/autolayout/style |$autolayout/autolayout/script" Index: website-common.xsl =================================================================== RCS file: /cvsroot/docbook/website/xsl/website-common.xsl,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** website-common.xsl 20 Mar 2002 16:53:55 -0000 1.6 --- website-common.xsl 12 May 2002 11:49:55 -0000 1.7 *************** *** 564,571 **** <!-- ==================================================================== --> ! <xsl:template name="link.to.page"> <xsl:param name="href" select="''"/> <xsl:param name="page" select="ancestor-or-self::tocentry"/> - <xsl:param name="linktext" select="'???'"/> <xsl:param name="relpath"> <xsl:call-template name="toc-rel-path"> --- 564,570 ---- <!-- ==================================================================== --> ! <xsl:template name="page.uri"> <xsl:param name="href" select="''"/> <xsl:param name="page" select="ancestor-or-self::tocentry"/> <xsl:param name="relpath"> <xsl:call-template name="toc-rel-path"> *************** *** 574,577 **** --- 573,580 ---- </xsl:param> + <!-- + <xsl:message><xsl:value-of select="$page/@id"/>: <xsl:value-of select="$relpath"/></xsl:message> + --> + <xsl:variable name="dir"> <xsl:choose> *************** *** 597,601 **** </xsl:variable> ! <a href="{$html.href}"> <xsl:if test="summary"> <xsl:attribute name="title"> --- 600,624 ---- </xsl:variable> ! <xsl:value-of select="$html.href"/> ! </xsl:template> ! ! <xsl:template name="link.to.page"> ! <xsl:param name="href" select="''"/> ! <xsl:param name="page" select="ancestor-or-self::tocentry"/> ! <xsl:param name="relpath"> ! <xsl:call-template name="toc-rel-path"> ! <xsl:with-param name="pageid" select="$page/@id"/> ! </xsl:call-template> ! </xsl:param> ! <xsl:param name="linktext" select="'???'"/> ! ! <a> ! <xsl:attribute name="href"> ! <xsl:call-template name="page.uri"> ! <xsl:with-param name="href" select="$href"/> ! <xsl:with-param name="page" select="$page"/> ! <xsl:with-param name="relpath" select="$relpath"/> ! </xsl:call-template> ! </xsl:attribute> <xsl:if test="summary"> <xsl:attribute name="title"> *************** *** 607,611 **** </xsl:template> - <xsl:template name="next.page"> <xsl:param name="page" select="ancestor-or-self::webpage"/> --- 630,633 ---- *************** *** 655,658 **** --- 677,727 ---- </xsl:variable> <xsl:value-of select="$previd"/> + </xsl:template> + + <xsl:template name="top.page"> + <xsl:param name="page" select="ancestor-or-self::webpage"/> + <xsl:variable name="id" select="$page/@id"/> + <xsl:variable name="tocentry" + select="$autolayout//*[@id=$id]"/> + + <xsl:value-of select="$tocentry/ancestor::toc/@id"/> + </xsl:template> + + <xsl:template name="up.page"> + <xsl:param name="page" select="ancestor-or-self::webpage"/> + <xsl:variable name="id" select="$page/@id"/> + <xsl:variable name="tocentry" + select="$autolayout//*[@id=$id]"/> + + <xsl:choose> + <xsl:when test="$tocentry/ancestor::tocentry"> + <xsl:value-of select="$tocentry/ancestor::tocentry[1]/@id"/> + </xsl:when> + <xsl:when test="$tocentry/ancestor::toc"> + <xsl:value-of select="$tocentry/ancestor::toc[1]/@id"/> + </xsl:when> + <xsl:otherwise></xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="first.page"> + <xsl:param name="page" select="ancestor-or-self::webpage"/> + <xsl:variable name="id" select="$page/@id"/> + <xsl:variable name="tocentry" + select="$autolayout//*[@id=$id]"/> + + <xsl:value-of select="$tocentry/preceding-sibling::tocentry[last()]/@id"/> + </xsl:template> + + <xsl:template name="last.page"> + <xsl:param name="page" select="ancestor-or-self::webpage"/> + <xsl:variable name="id" select="$page/@id"/> + <xsl:variable name="tocentry" + select="$autolayout//*[@id=$id]"/> + + <xsl:variable name="prev-sibling" + select="$tocentry/preceding-sibling::tocentry[1]"/> + + <xsl:value-of select="$tocentry/following-sibling::tocentry[last()]/@id"/> </xsl:template> |