Update of /cvsroot/docbook/website/xsl In directory usw-pr-cvs1:/tmp/cvs-serv10432/xsl Modified Files: Tag: V2-branch autolayout.xsl param.xsl toc-tabular.xsl toc.xsl website-common.xsl website.xsl Log Message: Allow the TOC to contain links to external websites, parameterize the currentpage marker (@) in the text-only rendering Index: autolayout.xsl =================================================================== RCS file: /cvsroot/docbook/website/xsl/Attic/autolayout.xsl,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -C2 -r1.1.2.5 -r1.1.2.6 *** autolayout.xsl 2001/08/04 21:25:51 1.1.2.5 --- autolayout.xsl 2001/08/07 13:38:22 1.1.2.6 *************** *** 59,62 **** --- 59,115 ---- <xsl:template name="tocentry"> + <xsl:choose> + <xsl:when test="@href"> + <xsl:call-template name="tocentry.href"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="tocentry.page"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="tocentry.href"> + <xsl:if test="not(@href)"> + <xsl:message terminate="yes"> + <xsl:text>All toc entries must have an href attribute.</xsl:text> + </xsl:message> + </xsl:if> + + <xsl:if test="not(@id)"> + <xsl:message terminate="yes"> + <xsl:text>All href toc entries must have an id attribute.</xsl:text> + </xsl:message> + </xsl:if> + + <xsl:message> + <xsl:text>off site: </xsl:text> + <xsl:value-of select="@href"/> + </xsl:message> + + <xsl:attribute name="id"> + <xsl:value-of select="@id"/> + </xsl:attribute> + <xsl:attribute name="href"> + <xsl:value-of select="@href"/> + </xsl:attribute> + <xsl:if test="@tocskip = '1'"> + <xsl:attribute name="tocskip"> + <xsl:value-of select="@tocskip"/> + </xsl:attribute> + </xsl:if> + + <xsl:if test="not(title)"> + <xsl:message terminate="yes"> + <xsl:text>Off-site links must provide a title.</xsl:text> + </xsl:message> + </xsl:if> + + <xsl:text> </xsl:text> + <xsl:apply-templates select="title|titleabbrev|summary" mode="copy"/> + <xsl:text> </xsl:text> + <xsl:apply-templates select="tocentry"/> + </xsl:template> + + <xsl:template name="tocentry.page"> <xsl:if test="not(@page)"> <xsl:message terminate="yes"> *************** *** 127,158 **** </xsl:attribute> </xsl:if> ! <title> <xsl:choose> ! <xsl:when test="$page/*[1]/head/titleabbrev"> ! <xsl:apply-templates select="$page/*[1]/head/titleabbrev"/> </xsl:when> <xsl:otherwise> ! <xsl:apply-templates select="$page/*[1]/head/title"/> </xsl:otherwise> </xsl:choose> - </title> - <xsl:text> </xsl:text> - - <xsl:if test="$page/*[1]/head/titleabbrev"> - <titleabbrev> - <xsl:apply-templates select="$page/*[1]/head/titleabbrev"/> - </titleabbrev> <xsl:text> </xsl:text> </xsl:if> ! <xsl:if test="$page/*[1]/head/summary"> ! <summary> ! <xsl:apply-templates select="$page/*[1]/head/summary"/> ! </summary> <xsl:text> </xsl:text> </xsl:if> ! <xsl:apply-templates/> </xsl:template> --- 180,226 ---- </xsl:attribute> </xsl:if> + + <xsl:text> </xsl:text> + <xsl:choose> + <xsl:when test="title"> + <xsl:apply-templates select="title" mode="copy"/> + </xsl:when> + <xsl:otherwise> + <title> + <xsl:apply-templates select="$page/*[1]/head/title"/> + </title> + </xsl:otherwise> + </xsl:choose> + <xsl:text> </xsl:text> ! <xsl:if test="titleabbrev or $page/*[1]/head/titleabbrev"> <xsl:choose> ! <xsl:when test="titleabbrev"> ! <xsl:apply-templates select="titleabbrev" mode="copy"/> </xsl:when> <xsl:otherwise> ! <titleabbrev> ! <xsl:apply-templates select="$page/*[1]/head/titleabbrev"/> ! </titleabbrev> </xsl:otherwise> </xsl:choose> <xsl:text> </xsl:text> </xsl:if> ! <xsl:if test="summary or $page/*[1]/head/summary"> ! <xsl:choose> ! <xsl:when test="summary"> ! <xsl:apply-templates select="summary" mode="copy"/> ! </xsl:when> ! <xsl:otherwise> ! <summary> ! <xsl:apply-templates select="$page/*[1]/head/summary"/> ! </summary> ! </xsl:otherwise> ! </xsl:choose> <xsl:text> </xsl:text> </xsl:if> ! <xsl:apply-templates select="tocentry"/> </xsl:template> Index: param.xsl =================================================================== RCS file: /cvsroot/docbook/website/xsl/Attic/param.xsl,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -r1.1.2.3 -r1.1.2.4 *** param.xsl 2001/06/04 20:38:03 1.1.2.3 --- param.xsl 2001/08/07 13:38:22 1.1.2.4 *************** *** 336,340 **** <xsl:param name="sequential.links" select="'0'"/> ! <doc:param name="" xmlns=""> <refpurpose></refpurpose> <refdescription> --- 336,340 ---- <xsl:param name="sequential.links" select="'0'"/> ! <doc:param name="sequential.links" xmlns=""> <refpurpose></refpurpose> <refdescription> *************** *** 344,349 **** <!-- ==================================================================== --> ! <doc:param name="" xmlns=""> <refpurpose></refpurpose> <refdescription> --- 344,350 ---- <!-- ==================================================================== --> + <xsl:param name="currentpage.marker" select="'@'"/> ! <doc:param name="currentpage.marker" xmlns=""> <refpurpose></refpurpose> <refdescription> Index: toc-tabular.xsl =================================================================== RCS file: /cvsroot/docbook/website/xsl/Attic/toc-tabular.xsl,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -r1.1.2.4 -r1.1.2.5 *** toc-tabular.xsl 2001/07/29 15:07:45 1.1.2.4 --- toc-tabular.xsl 2001/08/07 13:38:22 1.1.2.5 *************** *** 222,225 **** --- 222,226 ---- <xsl:when test="$nav.graphics"> <xsl:call-template name="link.to.page"> + <xsl:with-param name="href" select="@href"/> <xsl:with-param name="page" select="$target"/> <xsl:with-param name="relpath" select="$relpath"/> *************** *** 280,283 **** --- 281,285 ---- <xsl:call-template name="link.to.page"> + <xsl:with-param name="href" select="@href"/> <xsl:with-param name="page" select="$target"/> <xsl:with-param name="relpath" select="$relpath"/> Index: toc.xsl =================================================================== RCS file: /cvsroot/docbook/website/xsl/Attic/toc.xsl,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -r1.1.2.3 -r1.1.2.4 *** toc.xsl 2001/06/20 13:10:32 1.1.2.3 --- toc.xsl 2001/08/07 13:38:22 1.1.2.4 *************** *** 45,57 **** </xsl:attribute> </img> ! <xsl:text>@</xsl:text> </xsl:when> <xsl:when test="$homebannertext"> <xsl:value-of select="$homebannertext/@value"/> ! <xsl:text>@</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>Home</xsl:text> ! <xsl:text>@</xsl:text> </xsl:otherwise> </xsl:choose> --- 45,57 ---- </xsl:attribute> </img> ! <xsl:value-of select="$currentpage.marker"/> </xsl:when> <xsl:when test="$homebannertext"> <xsl:value-of select="$homebannertext/@value"/> ! <xsl:value-of select="$currentpage.marker"/> </xsl:when> <xsl:otherwise> <xsl:text>Home</xsl:text> ! <xsl:value-of select="$currentpage.marker"/> </xsl:otherwise> </xsl:choose> *************** *** 108,115 **** </xsl:otherwise> </xsl:choose> ! <xsl:text>@</xsl:text> </xsl:when> <xsl:otherwise> ! <a href="{$relpath}{@dir}{$filename-prefix}{@filename}"> <xsl:choose> <xsl:when test="titleabbrev"> --- 108,128 ---- </xsl:otherwise> </xsl:choose> ! <xsl:value-of select="$currentpage.marker"/> </xsl:when> <xsl:otherwise> ! <a> ! <xsl:attribute name="href"> ! <xsl:choose> ! <xsl:when test="@href"> ! <xsl:value-of select="@href"/> ! </xsl:when> ! <xsl:otherwise> ! <xsl:value-of select="$relpath"/> ! <xsl:value-of select="@dir"/> ! <xsl:value-of select="$filename-prefix"/> ! <xsl:value-of select="@filename"/> ! </xsl:otherwise> ! </xsl:choose> ! </xsl:attribute> <xsl:choose> <xsl:when test="titleabbrev"> Index: website-common.xsl =================================================================== RCS file: /cvsroot/docbook/website/xsl/Attic/website-common.xsl,v retrieving revision 1.1.2.9 retrieving revision 1.1.2.10 diff -C2 -r1.1.2.9 -r1.1.2.10 *** website-common.xsl 2001/08/04 21:27:41 1.1.2.9 --- website-common.xsl 2001/08/07 13:38:22 1.1.2.10 *************** *** 558,561 **** --- 558,562 ---- <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="'???'"/> *************** *** 577,581 **** </xsl:variable> ! <a href="{$relpath}{$dir}{$filename-prefix}{$page/@filename}"> <xsl:if test="summary"> <xsl:attribute name="title"> --- 578,594 ---- </xsl:variable> ! <xsl:variable name="html.href"> ! <xsl:choose> ! <xsl:when test="$href != ''"> ! <xsl:value-of select="$href"/> ! </xsl:when> ! <xsl:otherwise> ! <xsl:value-of select="concat($relpath,$dir,$filename-prefix)"/> ! <xsl:value-of select="$page/@filename"/> ! </xsl:otherwise> ! </xsl:choose> ! </xsl:variable> ! ! <a href="{$html.href}"> <xsl:if test="summary"> <xsl:attribute name="title"> Index: website.xsl =================================================================== RCS file: /cvsroot/docbook/website/xsl/website.xsl,v retrieving revision 1.2.4.3 retrieving revision 1.2.4.4 diff -C2 -r1.2.4.3 -r1.2.4.4 *** website.xsl 2001/06/04 20:39:17 1.2.4.3 --- website.xsl 2001/08/07 13:38:22 1.2.4.4 *************** *** 92,96 **** <xsl:for-each select="$pages"> <li> ! <a href="{$relpath}{@dir}{$filename-prefix}{@filename}"> <xsl:apply-templates select="title"/> </a> --- 92,109 ---- <xsl:for-each select="$pages"> <li> ! <a> ! <xsl:attribute name="href"> ! <xsl:choose> ! <xsl:when test="@href"> ! <xsl:value-of select="@href"/> ! </xsl:when> ! <xsl:otherwise> ! <xsl:value-of select="$relpath"/> ! <xsl:value-of select="@dir"/> ! <xsl:value-of select="$filename-prefix"/> ! <xsl:value-of select="@filename"/> ! </xsl:otherwise> ! </xsl:choose> ! </xsl:attribute> <xsl:apply-templates select="title"/> </a> |