From: <bob...@us...> - 2011-11-12 00:05:51
|
Revision: 9147 http://docbook.svn.sourceforge.net/docbook/?rev=9147&view=rev Author: bobstayton Date: 2011-11-12 00:05:44 +0000 (Sat, 12 Nov 2011) Log Message: ----------- Add support for chunked.filename.prefix param. Make sure base.dir value has a trailing slash in the chunk.base.dir internal param used by the templates. Modified Paths: -------------- trunk/xsl/html/chunk-code.xsl trunk/xsl/html/chunk-common.xsl trunk/xsl/html/chunker.xsl trunk/xsl/html/chunktoc.xsl trunk/xsl/html/graphics.xsl trunk/xsl/html/html.xsl trunk/xsl/html/titlepage.xsl Modified: trunk/xsl/html/chunk-code.xsl =================================================================== --- trunk/xsl/html/chunk-code.xsl 2011-11-11 23:17:20 UTC (rev 9146) +++ trunk/xsl/html/chunk-code.xsl 2011-11-12 00:05:44 UTC (rev 9147) @@ -54,6 +54,8 @@ <xsl:call-template name="dbhtml-dir"/> </xsl:if> + <xsl:value-of select="$chunked.filename.prefix"/> + <xsl:value-of select="$fn"/> <!-- You can't add the html.ext here because dbhtml filename= may already --> <!-- have added it. It really does have to be handled in the recursive template --> @@ -590,7 +592,7 @@ <xsl:call-template name="make-relative-filename"> <xsl:with-param name="base.dir"> <xsl:if test="$manifest.in.base.dir = 0"> - <xsl:value-of select="$base.dir"/> + <xsl:value-of select="$chunk.base.dir"/> </xsl:if> </xsl:with-param> <xsl:with-param name="base.name"> @@ -610,7 +612,7 @@ <xsl:call-template name="make-relative-filename"> <xsl:with-param name="base.dir"> <xsl:if test="$manifest.in.base.dir = 0"> - <xsl:value-of select="$base.dir"/> + <xsl:value-of select="$chunk.base.dir"/> </xsl:if> </xsl:with-param> <xsl:with-param name="base.name"> @@ -629,7 +631,7 @@ <xsl:call-template name="make-relative-filename"> <xsl:with-param name="base.dir"> <xsl:if test="$manifest.in.base.dir = 0"> - <xsl:value-of select="$base.dir"/> + <xsl:value-of select="$chunk.base.dir"/> </xsl:if> </xsl:with-param> <xsl:with-param name="base.name"> Modified: trunk/xsl/html/chunk-common.xsl =================================================================== --- trunk/xsl/html/chunk-common.xsl 2011-11-11 23:17:20 UTC (rev 9146) +++ trunk/xsl/html/chunk-common.xsl 2011-11-12 00:05:44 UTC (rev 9147) @@ -143,7 +143,7 @@ <xsl:variable name="filename"> <xsl:call-template name="make-relative-filename"> - <xsl:with-param name="base.dir" select="$base.dir"/> + <xsl:with-param name="base.dir" select="$chunk.base.dir"/> <xsl:with-param name="base.name" select="$chunkfn"/> </xsl:call-template> </xsl:variable> @@ -613,9 +613,10 @@ <xsl:call-template name="write.chunk"> <xsl:with-param name="filename"> <xsl:call-template name="make-relative-filename"> - <xsl:with-param name="base.dir" select="$base.dir"/> + <xsl:with-param name="base.dir" select="$chunk.base.dir"/> <xsl:with-param name="base.name"> <xsl:call-template name="dbhtml-dir"/> + <xsl:value-of select="$chunked.filename.prefix"/> <xsl:apply-templates select="." mode="recursive-chunk-filename"> <xsl:with-param name="recursive" select="true()"/> </xsl:apply-templates> @@ -656,7 +657,7 @@ <xsl:if test="string($lot) != ''"> <xsl:variable name="filename"> <xsl:call-template name="make-relative-filename"> - <xsl:with-param name="base.dir" select="$base.dir"/> + <xsl:with-param name="base.dir" select="$chunk.base.dir"/> <xsl:with-param name="base.name"> <xsl:call-template name="dbhtml-dir"/> <xsl:value-of select="$type"/> @@ -1694,6 +1695,7 @@ <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'"> <a accesskey="t"> <xsl:attribute name="href"> + <xsl:value-of select="$chunked.filename.prefix"/> <xsl:apply-templates select="/*[1]" mode="recursive-chunk-filename"> <xsl:with-param name="recursive" select="true()"/> @@ -1883,7 +1885,7 @@ <xsl:call-template name="write.text.chunk"> <xsl:with-param name="filename"> <xsl:if test="$manifest.in.base.dir != 0"> - <xsl:value-of select="$base.dir"/> + <xsl:value-of select="$chunk.base.dir"/> </xsl:if> <xsl:value-of select="$manifest"/> </xsl:with-param> Modified: trunk/xsl/html/chunker.xsl =================================================================== --- trunk/xsl/html/chunker.xsl 2011-11-11 23:17:20 UTC (rev 9146) +++ trunk/xsl/html/chunker.xsl 2011-11-12 00:05:44 UTC (rev 9147) @@ -34,6 +34,20 @@ <xsl:param name="chunker.output.media-type" select="''"/> <xsl:param name="chunker.output.cdata-section-elements" select="''"/> +<!-- Make sure base.dir has a trailing slash now --> +<xsl:param name="chunk.base.dir"> + <xsl:choose> + <xsl:when test="string-length($base.dir) = 0"></xsl:when> + <!-- make sure to add trailing slash if omitted by user --> + <xsl:when test="substring($base.dir, string-length($base.dir), 1) = '/'"> + <xsl:value-of select="$base.dir"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($base.dir, '/')"/> + </xsl:otherwise> + </xsl:choose> +</xsl:param> + <xsl:param name="saxon.character.representation" select="'entity;decimal'"/> <!-- ==================================================================== --> @@ -46,13 +60,13 @@ <!-- put Saxon first to work around a bug in libxslt --> <xsl:when test="element-available('saxon:output')"> <!-- Saxon doesn't make the chunks relative --> - <xsl:value-of select="concat($base.dir,$base.name)"/> + <xsl:value-of select="concat($chunk.base.dir,$base.name)"/> </xsl:when> <xsl:when test="element-available('exsl:document')"> <!-- EXSL document does make the chunks relative, I think --> <xsl:choose> <xsl:when test="count(parent::*) = 0"> - <xsl:value-of select="concat($base.dir,$base.name)"/> + <xsl:value-of select="concat($chunk.base.dir,$base.name)"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$base.name"/> @@ -61,7 +75,7 @@ </xsl:when> <xsl:when test="element-available('redirect:write')"> <!-- Xalan doesn't make the chunks relative --> - <xsl:value-of select="concat($base.dir,$base.name)"/> + <xsl:value-of select="concat($chunk.base.dir,$base.name)"/> </xsl:when> <xsl:otherwise> <xsl:message terminate="yes"> Modified: trunk/xsl/html/chunktoc.xsl =================================================================== --- trunk/xsl/html/chunktoc.xsl 2011-11-11 23:17:20 UTC (rev 9146) +++ trunk/xsl/html/chunktoc.xsl 2011-11-12 00:05:44 UTC (rev 9147) @@ -96,7 +96,7 @@ <xsl:variable name="filename"> <xsl:call-template name="make-relative-filename"> - <xsl:with-param name="base.dir" select="$base.dir"/> + <xsl:with-param name="base.dir" select="$chunk.base.dir"/> <xsl:with-param name="base.name" select="$chunkfn"/> </xsl:call-template> </xsl:variable> @@ -443,7 +443,7 @@ <xsl:call-template name="write.chunk"> <xsl:with-param name="filename"> <xsl:call-template name="make-relative-filename"> - <xsl:with-param name="base.dir" select="$base.dir"/> + <xsl:with-param name="base.dir" select="$chunk.base.dir"/> <xsl:with-param name="base.name"> <xsl:call-template name="dbhtml-dir"/> <xsl:apply-templates select="." mode="recursive-chunk-filename"> @@ -484,7 +484,7 @@ <xsl:if test="string($lot) != ''"> <xsl:variable name="filename"> <xsl:call-template name="make-relative-filename"> - <xsl:with-param name="base.dir" select="$base.dir"/> + <xsl:with-param name="base.dir" select="$chunk.base.dir"/> <xsl:with-param name="base.name"> <xsl:call-template name="dbhtml-dir"/> <xsl:value-of select="$type"/> @@ -496,6 +496,7 @@ <xsl:variable name="href"> <xsl:call-template name="make-relative-filename"> + <xsl:with-param name="base.dir" select="''"/> <xsl:with-param name="base.name"> <xsl:call-template name="dbhtml-dir"/> <xsl:value-of select="$type"/> Modified: trunk/xsl/html/graphics.xsl =================================================================== --- trunk/xsl/html/graphics.xsl 2011-11-11 23:17:20 UTC (rev 9146) +++ trunk/xsl/html/graphics.xsl 2011-11-12 00:05:44 UTC (rev 9147) @@ -1284,7 +1284,7 @@ <xsl:value-of select="$dbhtml.dir"/> </xsl:when> <xsl:otherwise> - <xsl:value-of select="$base.dir"/> + <xsl:value-of select="$chunk.base.dir"/> </xsl:otherwise> </xsl:choose> </xsl:with-param> @@ -1363,7 +1363,7 @@ <xsl:variable name="this.uri"> <xsl:call-template name="make-relative-filename"> - <xsl:with-param name="base.dir" select="$base.dir"/> + <xsl:with-param name="base.dir" select="$chunk.base.dir"/> <xsl:with-param name="base.name"> <xsl:call-template name="href.target.uri"/> </xsl:with-param> Modified: trunk/xsl/html/html.xsl =================================================================== --- trunk/xsl/html/html.xsl 2011-11-11 23:17:20 UTC (rev 9146) +++ trunk/xsl/html/html.xsl 2011-11-12 00:05:44 UTC (rev 9147) @@ -204,7 +204,7 @@ <xsl:param name="context" select="."/> <xsl:param name="object" select="."/> <xsl:if test="$manifest.in.base.dir = 0"> - <xsl:value-of select="$base.dir"/> + <xsl:value-of select="$chunk.base.dir"/> </xsl:if> <xsl:call-template name="href.target"> <xsl:with-param name="context" select="$context"/> @@ -610,7 +610,7 @@ </xsl:call-template> </xsl:variable> - <xsl:variable name="path" select="concat($base.dir, $file)"/> + <xsl:variable name="path" select="concat($chunk.base.dir, $file)"/> <xsl:value-of select="$path"/> </xsl:template> Modified: trunk/xsl/html/titlepage.xsl =================================================================== --- trunk/xsl/html/titlepage.xsl 2011-11-11 23:17:20 UTC (rev 9146) +++ trunk/xsl/html/titlepage.xsl 2011-11-12 00:05:44 UTC (rev 9147) @@ -555,7 +555,7 @@ <xsl:variable name="filename"> <xsl:call-template name="make-relative-filename"> - <xsl:with-param name="base.dir" select="$base.dir"/> + <xsl:with-param name="base.dir" select="$chunk.base.dir"/> <xsl:with-param name="base.name" select="$file"/> </xsl:call-template> </xsl:variable> @@ -806,7 +806,7 @@ <xsl:variable name="filename"> <xsl:call-template name="make-relative-filename"> - <xsl:with-param name="base.dir" select="$base.dir"/> + <xsl:with-param name="base.dir" select="$chunk.base.dir"/> <xsl:with-param name="base.name" select="$file"/> </xsl:call-template> </xsl:variable> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |