<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="no" doctype-public="-//Norman Walsh//DTD Website Autolayout V2.5.0//EN" doctype-system="http://docbook.sourceforge.net/release/website/2.5.0/schema/dtd/autolayout.dtd" /> <xsl:strip-space elements="toc tocentry layout copyright"/> <xsl:template match="layout"> <autolayout> <xsl:text> </xsl:text> <xsl:apply-templates/> </autolayout> <xsl:text> </xsl:text> </xsl:template> <xsl:template match="style|script|headlink|copyright|config"> <xsl:apply-templates select="." mode="copy"/> </xsl:template> <xsl:template match="*" mode="copy"> <xsl:element name="{name(.)}"> <xsl:copy-of select="@*"/> <xsl:apply-templates mode="copy"/> </xsl:element> </xsl:template> <xsl:template match="toc"> <xsl:if test="not(@page)"> <xsl:message terminate="yes"> <xsl:text>All toc entries must have a page attribute.</xsl:text> </xsl:message> </xsl:if> <xsl:variable name="page" select="document(@page,.)"/> <toc> <xsl:call-template name="tocentry"/> </toc> <xsl:text> </xsl:text> </xsl:template> <xsl:template match="tocentry"> <tocentry> <xsl:call-template name="tocentry"/> </tocentry> <xsl:text> </xsl:text> </xsl:template> <xsl:template match="notoc"> <notoc> <xsl:call-template name="tocentry"/> </notoc> <xsl:text> </xsl:text> </xsl:template> <xsl:template name="tocentry"> <xsl:if test="@revisionflag"> <xsl:attribute name="revisionflag"> <xsl:value-of select="@revisionflag"/> </xsl:attribute> </xsl:if> <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"> <xsl:text>All toc entries must have a page attribute.</xsl:text> </xsl:message> </xsl:if> <xsl:variable name="page" select="document(@page,.)"/> <xsl:if test="not($page/*[1]/@id)"> <xsl:message terminate="yes"> <xsl:value-of select="@page"/> <xsl:text>: missing ID.</xsl:text> </xsl:message> </xsl:if> <xsl:variable name="id" select="$page/*[1]/@id"/> <xsl:variable name="filename"> <xsl:choose> <xsl:when test="@filename"> <xsl:value-of select="@filename"/> </xsl:when> <xsl:when test="/layout/config[@param='default-filename']"> <xsl:value-of select="(/layout/config[@param='default-filename'])[1]/@value"/> </xsl:when> <xsl:otherwise>index.html</xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="dir"> <xsl:apply-templates select="." mode="calculate-dir"/> </xsl:variable> <xsl:if test="$filename = ''"> <xsl:message terminate="yes"> <xsl:value-of select="@page"/> <xsl:text>: missing filename.</xsl:text> </xsl:message> </xsl:if> <xsl:message> <xsl:value-of select="@page"/> <xsl:text>: </xsl:text> <xsl:if test="$dir != ''"> <xsl:value-of select="$dir"/> </xsl:if> <xsl:value-of select="$filename"/> </xsl:message> <xsl:attribute name="page"> <xsl:value-of select="@page"/> </xsl:attribute> <xsl:attribute name="id"> <xsl:value-of select="$id"/> </xsl:attribute> <xsl:if test="$dir != ''"> <xsl:attribute name="dir"> <xsl:value-of select="$dir"/> </xsl:attribute> </xsl:if> <xsl:attribute name="filename"> <xsl:value-of select="$filename"/> </xsl:attribute> <xsl:if test="@tocskip = '1'"> <xsl:attribute name="tocskip"> <xsl:value-of select="@tocskip"/> </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> <xsl:template match="*" mode="calculate-dir"> <xsl:choose> <xsl:when test="starts-with(@dir, '/')"> <!-- if the directory on this begins with a "/", we're done... --> <xsl:value-of select="substring-after(@dir, '/')"/> <xsl:text>/</xsl:text> </xsl:when> <xsl:when test="parent::*"> <!-- if there's a parent, try it --> <xsl:apply-templates select="parent::*" mode="calculate-dir"/> <xsl:if test="@dir"> <xsl:value-of select="@dir"/> <xsl:text>/</xsl:text> </xsl:if> </xsl:when> <xsl:otherwise> <xsl:if test="@dir"> <xsl:value-of select="@dir"/> <xsl:text>/</xsl:text> </xsl:if> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 26953 | Paul Allen | Move //guest/perforce_software/p4convert to //guest/perforce_software/p4convert/main | ||
//guest/perforce_software/p4convert/docs/docbook-xsl-ns-1.78.1/website/autolayout.xsl | |||||
#2 | 14806 | Paul Allen | Update docs and add +w. | ||
#1 | 13920 | Paul Allen | copy part 2 (no errors) | ||
//guest/paul_allen/p4convert-maven/docs/docbook-xsl-ns-1.78.1/website/autolayout.xsl | |||||
#1 | 13895 | Paul Allen | Copying using p4convert-docbook | ||
//guest/perforce_software/doc_build/main/docbook-xsl-ns-1.78.1/website/autolayout.xsl | |||||
#1 | 12728 | eedwards |
Upgrade ANT doc build infrastructure to assemble PDFs: - remove non-namespaced DocBook source and add namespaced DocBook source. - add Apache FOP 1.1 - copy fonts, images, XSL into _build, establishing new asset structure. The original structure remains until all guides using it can be upgraded, and several other issues can be resolved. - updated build.xml to allow for per-target build properties. - upgraded the P4SAG to use the new infrastructure. - tweaked admonition presentation in PDFs to remove admonition graphics, and resemble closely the presentation used in the new HTML layout, including the same colors. With these changes, building PDFs involves using a shell, navigating into the guide's directory (just P4SAG for now), and executing "ant pdf". Issues still to be resolved: - PDF generation encounters several warnings about missing fonts (bold versions of Symbol and ZapfDingbats), and a couple of locations where the page content exceeds the defined content area. - Due to issues within Apache FOP, PDF generation emits a substantial amount of output that is not easily suppressed without losing important warning information. - Apache FOP's interface to ANT does not expose a way to set the font base directory. The current configuration does work under Mac OSX, but further testing on Windows will need to be done to determine if the relative paths defined continue to work. The workaround is for Windows users to customize the fop-config.xml to provide absolute system paths to the required fonts. - HTML generation needs further browser testing, and exhibits broken navigation on iOS browsers within the TOC sidebar. - A number of PDF and HTML presentation tweaks still need to be made, for example: sidebars, gui* DocBook tags, whitespace, section separation, etc. |