From: <xm...@us...> - 2007-08-29 05:25:32
|
Revision: 7346 http://docbook.svn.sourceforge.net/docbook/?rev=7346&view=rev Author: xmldoc Date: 2007-08-28 22:25:22 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Added customization layers for XSL-NS stylesheets, and set up added targets to makefile for generating output using those. Modified Paths: -------------- trunk/docbook/relaxng/docbook/howto/Makefile Added Paths: ----------- trunk/docbook/relaxng/docbook/howto/stylesheets/fo-ns.xsl trunk/docbook/relaxng/docbook/howto/stylesheets/html-ns.xsl Modified: trunk/docbook/relaxng/docbook/howto/Makefile =================================================================== --- trunk/docbook/relaxng/docbook/howto/Makefile 2007-08-29 03:02:02 UTC (rev 7345) +++ trunk/docbook/relaxng/docbook/howto/Makefile 2007-08-29 05:25:22 UTC (rev 7346) @@ -2,18 +2,40 @@ HTMLSTYLE=stylesheets/html.xsl FOSTYLE=stylesheets/fo.xsl +# below are customizations layers for XSL-NS stylesheets +HTMLNSSTYLE=stylesheets/html-ns.xsl +FONSSTYLE=stylesheets/fo-ns.xsl VARS= all: howto.html howto.pdf +# output using the namespaced stylesheets +ns: howto.ns.html howto.ns.pdf + %.html : %.xml $(HTMLSTYLE) jing -c ../docbook.rnc $< $(XSLT) $< $(HTMLSTYLE) $@ $(VARS) +%.ns.html : %.xml $(HTMLNSSTYLE) + jing -c ../docbook.rnc $< + $(XSLT) $< $(HTMLNSSTYLE) $@ $(VARS) %.fo : %.xml $(FOSTYLE) jing -c ../docbook.rnc $< $(XSLT) $< $(FOSTYLE) $@ xep.extensions=1 $(VARS) +%.ns.fo : %.xml $(FONSSTYLE) + jing -c ../docbook.rnc $< + $(XSLT) $< $(FONSSTYLE) $@ xep.extensions=1 $(VARS) + %.pdf : %.fo xep $< + +%.ns.pdf : %.ns.fo + xep $< + +clean: + $(RM) howto.html + $(RM) howto.pdf + $(RM) howto.ns.html + $(RM) howto.ns.pdf Added: trunk/docbook/relaxng/docbook/howto/stylesheets/fo-ns.xsl =================================================================== --- trunk/docbook/relaxng/docbook/howto/stylesheets/fo-ns.xsl (rev 0) +++ trunk/docbook/relaxng/docbook/howto/stylesheets/fo-ns.xsl 2007-08-29 05:25:22 UTC (rev 7346) @@ -0,0 +1,153 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:fo="http://www.w3.org/1999/XSL/Format" + xmlns:d="http://docbook.org/ns/docbook" + exclude-result-prefixes="d" + version="1.0"> + +<xsl:import href="http://docbook.sourceforge.net/release/xsl-ns/current/fo/profile-docbook.xsl"/> + +<xsl:param name="profile.status">final</xsl:param> + +<xsl:param name="body.start.indent" select="'0pt'"/> +<xsl:param name="title.margin.left" select="'0pt'"/> + +<xsl:attribute-set name="urilist"> + <xsl:attribute name="margin-left">0.5in</xsl:attribute> +</xsl:attribute-set> + +<xsl:template name="article.titlepage"> + <fo:block text-align="left"> + <xsl:apply-templates select="d:info" mode="howto-titlepage"/> + </fo:block> +</xsl:template> + +<xsl:template match="d:info" mode="howto-titlepage"> + <xsl:apply-templates select="d:title" mode="howto-titlepage"/> + <xsl:apply-templates select="d:subtitle" mode="howto-titlepage"/> + <xsl:apply-templates select="d:pubdate[1]" mode="howto-titlepage"/> + <xsl:apply-templates select="d:pubdate[1]" mode="version-list"/> + <xsl:apply-templates select="d:authorgroup" mode="howto-titlepage"/> +</xsl:template> + +<xsl:template match="d:title" mode="howto-titlepage"> + <fo:block font-size="24pt" font-weight="bold" font-family="sans-serif" + margin-bottom="5pt"> + <xsl:apply-templates/> + </fo:block> +</xsl:template> + +<xsl:template match="d:subtitle" mode="howto-titlepage"> + <fo:block font-size="18pt" font-weight="bold" font-family="sans-serif" + margin-bottom="5pt"> + <xsl:apply-templates/> + </fo:block> +</xsl:template> + +<xsl:template match="d:pubdate" mode="howto-titlepage"> + <fo:block font-size="16pt" font-weight="bold" margin-bottom="15pt" + font-family="sans-serif"> + <xsl:call-template name="datetime.format"> + <xsl:with-param name="date" select="."/> + <xsl:with-param name="format" select="'d B Y'"/> + </xsl:call-template> + </fo:block> +</xsl:template> + +<xsl:template match="d:pubdate[1]" priority="10" + mode="version-list"> + <fo:block font-size="12pt" font-family="sans-serif">This version:</fo:block> + + <fo:block xsl:use-attribute-sets="urilist"> + <xsl:apply-templates select="." mode="datedURI"/> + </fo:block> + + <fo:block font-size="12pt" font-family="sans-serif">Latest version:</fo:block> + <fo:block xsl:use-attribute-sets="urilist"> + <fo:inline>http://docbook.org/docs/howto/</fo:inline> + </fo:block> + + <xsl:if test="following-sibling::d:pubdate"> + <fo:block font-size="12pt" font-family="sans-serif"> + <xsl:text>Previous version</xsl:text> + <xsl:if test="count(following-sibling::d:pubdate) > 1"> + <xsl:text>s</xsl:text> + </xsl:if> + <xsl:text>:</xsl:text> + </fo:block> + <xsl:apply-templates + select="following-sibling::d:pubdate" + mode="version-list"/> + </xsl:if> +</xsl:template> + +<xsl:template match="d:pubdate" mode="version-list"> + <xsl:if test="count(preceding-sibling::d:pubdate) < 4"> + <fo:block xsl:use-attribute-sets="urilist"> + <xsl:apply-templates select="." mode="datedURI"/> + </fo:block> + </xsl:if> +</xsl:template> + +<xsl:template match="d:pubdate" mode="datedURI"> + <xsl:variable name="uri"> + <xsl:text>http://docbook.org/docs/howto/</xsl:text> + <xsl:value-of select="substring(.,1,4)"/> + <xsl:text>-</xsl:text> + <xsl:value-of select="substring(.,6,2)"/> + <xsl:text>-</xsl:text> + <xsl:value-of select="substring(.,9,2)"/> + <xsl:text>/</xsl:text> + </xsl:variable> + + <fo:inline> + <xsl:value-of select="$uri"/> + </fo:inline> +</xsl:template> + +<xsl:template match="d:authorgroup" mode="howto-titlepage"> + <fo:block font-size="12pt" font-family="sans-serif"> + <xsl:text>Author</xsl:text> + <xsl:if test="count(d:author) > 1">s</xsl:if> + <xsl:text>:</xsl:text> + </fo:block> + <xsl:apply-templates select="d:author" mode="howto-titlepage"/> +</xsl:template> + +<xsl:template match="d:author" mode="howto-titlepage"> + <fo:block xsl:use-attribute-sets="urilist"> + <xsl:apply-templates select="d:personname"/> + <xsl:if test="d:email"> + <xsl:text>, </xsl:text> + <xsl:apply-templates select="d:email"/> + </xsl:if> + </fo:block> +</xsl:template> + +<xsl:attribute-set name="monospace.properties"> + <xsl:attribute name="font-stretch">narrower</xsl:attribute> +</xsl:attribute-set> + +<xsl:param name="draft.watermark.image" select="''"/> + +<xsl:param name="ulink.footnotes" select="1"/> + +<xsl:template match="d:programlisting[@language]"> + <fo:block clear="left"/> + <fo:float float="start"> + <fo:block width="0.4cm" text-align="end" font-family="Helvetica" font-size="7pt" font-weight="bold" + margin-left="-0.4cm"> + <xsl:if test="not(preceding-sibling::*[1]/self::d:programlisting)"> + <xsl:attribute name="margin-top">1.5em</xsl:attribute> + </xsl:if> + <fo:block-container reference-orientation="90" width="0.8cm"> + <fo:block color="white" background-color="#808080" text-align="center"> + <xsl:value-of select="translate(@language,'rngc','RNGC')"/> + </fo:block> + </fo:block-container> + </fo:block> + </fo:float> + <xsl:apply-imports/> +</xsl:template> + +</xsl:stylesheet> Copied: trunk/docbook/relaxng/docbook/howto/stylesheets/html-ns.xsl (from rev 7302, trunk/docbook/relaxng/docbook/howto/stylesheets/html.xsl) =================================================================== --- trunk/docbook/relaxng/docbook/howto/stylesheets/html-ns.xsl (rev 0) +++ trunk/docbook/relaxng/docbook/howto/stylesheets/html-ns.xsl 2007-08-29 05:25:22 UTC (rev 7346) @@ -0,0 +1,233 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:d="http://docbook.org/ns/docbook" + exclude-result-prefixes="d" + version="1.0"> + +<xsl:import href="http://docbook.sourceforge.net/release/xsl-ns/current/html/profile-docbook.xsl"/> + +<xsl:param name="profile.status">final</xsl:param> + +<xsl:template name="user.head.content"> + <xsl:param name="node" select="."/> + + <link rel="stylesheet" type="text/css" + href="http://docbook.org/docs/howto/howto.css" /> +</xsl:template> + +<xsl:template name="article.titlepage"> + <div class="titlepage"> + <xsl:apply-templates select="d:info" mode="howto-titlepage"/> + <hr/> + </div> +</xsl:template> + +<xsl:template match="d:info" mode="howto-titlepage"> + <xsl:apply-templates select="d:title" mode="howto-titlepage"/> + <xsl:apply-templates select="d:subtitle" mode="howto-titlepage"/> + <xsl:apply-templates select="d:pubdate[1]" mode="howto-titlepage"/> + <div class="metadata"> + <xsl:apply-templates select="d:pubdate[1]" mode="version-list"/> + <xsl:apply-templates select="d:authorgroup" mode="howto-titlepage"/> + </div> +</xsl:template> + +<xsl:template match="d:title" mode="howto-titlepage"> + <h1> + <xsl:apply-templates/> + </h1> +</xsl:template> + +<xsl:template match="d:subtitle" mode="howto-titlepage"> + <h2> + <xsl:apply-templates/> + </h2> +</xsl:template> + +<xsl:template match="d:pubdate" mode="howto-titlepage"> + <h3> + <xsl:call-template name="datetime.format"> + <xsl:with-param name="date" select="."/> + <xsl:with-param name="format" select="'d B Y'"/> + </xsl:call-template> + </h3> +</xsl:template> + +<xsl:template match="d:pubdate[1]" priority="10" + mode="version-list"> + <h4>This version:</h4> + <dl class="urilist"> + <dt> + <xsl:apply-templates select="." mode="datedURI"/> + </dt> + </dl> + + <h4>Latest version:</h4> + <dl class="urilist"> + <dt> + <span>http://docbook.org/docs/howto/</span> + <xsl:text> (</xsl:text> + <a href="http://docbook.org/docs/howto/">HTML</a> + <xsl:text>, </xsl:text> + <a href="http://docbook.org/docs/howto/howto.xml">XML</a> + <xsl:text>, </xsl:text> + <a href="http://docbook.org/docs/howto/howto.pdf">PDF</a> + <xsl:text>)</xsl:text> + </dt> + </dl> + + <xsl:if test="following-sibling::d:pubdate"> + <h4> + <xsl:text>Previous version</xsl:text> + <xsl:if test="count(following-sibling::d:pubdate) > 1"> + <xsl:text>s</xsl:text> + </xsl:if> + <xsl:text>:</xsl:text> + </h4> + <dl class="urilist"> + <xsl:apply-templates + select="following-sibling::d:pubdate" + mode="version-list"/> + </dl> + </xsl:if> +</xsl:template> + +<xsl:template match="d:pubdate" mode="version-list"> + <xsl:if test="count(preceding-sibling::d:pubdate) < 4"> + <dt> + <xsl:apply-templates select="." mode="datedURI"/> + </dt> + </xsl:if> +</xsl:template> + +<xsl:template match="d:pubdate" mode="datedURI"> + <xsl:variable name="uri"> + <xsl:text>http://docbook.org/docs/howto/</xsl:text> + <xsl:value-of select="substring(.,1,4)"/> + <xsl:text>-</xsl:text> + <xsl:value-of select="substring(.,6,2)"/> + <xsl:text>-</xsl:text> + <xsl:value-of select="substring(.,9,2)"/> + <xsl:text>/</xsl:text> + </xsl:variable> + + <span> + <xsl:value-of select="$uri"/> + </span> + <xsl:text> (</xsl:text> + <a href="{$uri}">HTML</a> + <xsl:text>, </xsl:text> + <a href="{$uri}howto.xml">XML</a> + <xsl:text>, </xsl:text> + <a href="{$uri}howto.pdf">PDF</a> + <xsl:text>)</xsl:text> +</xsl:template> + +<xsl:template match="d:authorgroup" mode="howto-titlepage"> + <h4> + <xsl:text>Author</xsl:text> + <xsl:if test="count(d:author) > 1">s</xsl:if> + <xsl:text>:</xsl:text> + </h4> + <dl class="authorlist"> + <xsl:apply-templates select="d:author" mode="howto-titlepage"/> + </dl> +</xsl:template> + +<xsl:template match="d:author" mode="howto-titlepage"> + <dt> + <xsl:apply-templates select="d:personname"/> + <xsl:if test="d:email"> + <xsl:text>, </xsl:text> + <xsl:apply-templates select="d:email"/> + </xsl:if> + </dt> +</xsl:template> + +<xsl:template match="d:tag[not(@class) or (@class='element')] + [not(@condition = 'nolink')]"> + <xsl:variable name="baseUri"> + <xsl:choose> + <xsl:when test="@condition = 'v4'"> + <xsl:text>http://docbook.org/tdg/en/html/</xsl:text> + </xsl:when> + <xsl:otherwise>http://docbook.org/tdg5/en/html/</xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <a href="{$baseUri}{.}.html"> + <xsl:apply-imports/> + </a> +</xsl:template> + +<!-- Support for labels identifying programlisting syntax used --> +<xsl:template match="d:programlisting[@language]"> + <xsl:param name="suppress-numbers" select="'0'"/> + <xsl:variable name="id"> + <xsl:call-template name="object.id"/> + </xsl:variable> + + <xsl:call-template name="anchor"/> + + <xsl:if test="$shade.verbatim != 0"> + <xsl:message> + <xsl:text>The shade.verbatim parameter is deprecated. </xsl:text> + <xsl:text>Use CSS instead,</xsl:text> + </xsl:message> + <xsl:message> + <xsl:text>for example: pre.</xsl:text> + <xsl:value-of select="local-name(.)"/> + <xsl:text> { background-color: #E0E0E0; }</xsl:text> + </xsl:message> + </xsl:if> + + <xsl:choose> + <xsl:when test="$suppress-numbers = '0' + and @linenumbering = 'numbered' + and $use.extensions != '0' + and $linenumbering.extension != '0'"> + <xsl:variable name="rtf"> + <xsl:apply-templates/> + </xsl:variable> + <pre class="{name(.)}"> + <xsl:call-template name="role.label"/> + <xsl:call-template name="number.rtf.lines"> + <xsl:with-param name="rtf" select="$rtf"/> + </xsl:call-template> + </pre> + </xsl:when> + <xsl:otherwise> + <pre class="{name(.)}"> + <xsl:call-template name="role.label"/> + <xsl:apply-templates/> + </pre> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template name="role.label"> + <span class="rolelabel"> + <xsl:call-template name="brealize"> + <xsl:with-param name="text" select="@language"/> + </xsl:call-template> + </span> +</xsl:template> + +<xsl:template name="brealize"> + <xsl:param name="text"/> + <xsl:variable name="head" select="substring($text, 1, 1)"/> + <xsl:variable name="tail" select="substring($text, 2)"/> + + <xsl:if test="$head != ''"> + <xsl:value-of select="$head"/> + </xsl:if> + + <xsl:if test="$tail != ''"> + <br/> + <xsl:call-template name="brealize"> + <xsl:with-param name="text" select="$tail"/> + </xsl:call-template> + </xsl:if> +</xsl:template> + +</xsl:stylesheet> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |