Author: maksimkaszynski
Date: 2007-09-11 09:35:34 -0400 (Tue, 11 Sep 2007)
New Revision: 2871
Added:
trunk/docs/xslt/en/src/main/xslt/fo-images-scaling.xsl
Modified:
trunk/docs/xslt/en/src/main/xslt/fopdf.xsl
Log:
http://jira.jboss.com/jira/browse/RF-875
Added: trunk/docs/xslt/en/src/main/xslt/fo-images-scaling.xsl
===================================================================
--- trunk/docs/xslt/en/src/main/xslt/fo-images-scaling.xsl (rev
0)
+++ trunk/docs/xslt/en/src/main/xslt/fo-images-scaling.xsl 2007-09-11 13:35:34 UTC (rev
2871)
@@ -0,0 +1,213 @@
+<?xml version='1.0'?>
+<!DOCTYPE xsl:stylesheet [
+<!ENTITY lowercase "'abcdefghijklmnopqrstuvwxyz'">
+<!ENTITY uppercase "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'">
+ ]>
+<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+
xmlns:fo="http://www.w3.org/1999/XSL/Format"
+
xmlns:xlink="http://www.w3.org/1999/xlink"
+
xmlns:stext="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.TextFactory...
+ xmlns:xtext="com.nwalsh.xalan.Text"
+
xmlns:lxslt="http://xml.apache.org/xslt"
+ exclude-result-prefixes="xlink stext xtext lxslt"
+ extension-element-prefixes="stext xtext"
+ version='1.0'>
+
+
+<!-- ==================================================================== -->
+<!-- Override these templates for FO -->
+<!-- ==================================================================== -->
+
+<xsl:import
href="http://docbook.sourceforge.net/release/xsl/current/lib/lib.xsl...
+<xsl:import
href="http://docbook.sourceforge.net/release/xsl/current/fo/graphics...
+<xsl:import
href="http://docbook.sourceforge.net/release/xsl/current/fo/pi.xsl&q...
+
+<xsl:template name="process.image">
+ <!-- When this template is called, the current node should be -->
+ <!-- a graphic, inlinegraphic, imagedata, or videodata. All -->
+ <!-- those elements have the same set of attributes, so we can -->
+ <!-- handle them all in one place. -->
+
+ <xsl:variable name="scalefit">
+ <xsl:choose>
+ <xsl:when test="$ignore.image.scaling != 0">0</xsl:when>
+ <xsl:when test="@contentwidth">0</xsl:when>
+ <xsl:when test="@contentdepth and
+ @contentdepth != '100%'">0</xsl:when>
+ <xsl:when test="@scale">0</xsl:when>
+ <xsl:when test="@scalefit"><xsl:value-of
select="@scalefit"/></xsl:when>
+ <xsl:when test="@width or @depth">1</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="scale">
+ <xsl:choose>
+ <xsl:when test="$ignore.image.scaling != 0">0</xsl:when>
+ <xsl:when test="@contentwidth or
@contentdepth">1.0</xsl:when>
+ <xsl:when test="@scale">
+ <xsl:value-of select="@scale div 100.0"/>
+ </xsl:when>
+ <xsl:otherwise>1.0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="filename">
+ <xsl:choose>
+ <xsl:when test="local-name(.) = 'graphic'
+ or local-name(.) = 'inlinegraphic'">
+ <!-- handle legacy graphic and inlinegraphic by new template -->
+ <xsl:call-template name="mediaobject.filename">
+ <xsl:with-param name="object" select="."/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- imagedata, videodata, audiodata -->
+ <xsl:call-template name="mediaobject.filename">
+ <xsl:with-param name="object" select=".."/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="content-type">
+ <xsl:if test="@format">
+ <xsl:call-template name="graphic.format.content-type">
+ <xsl:with-param name="format" select="@format"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+
+ <xsl:variable name="bgcolor">
+
+ <xsl:call-template name="pi.dbfo_background-color">
+ <xsl:with-param name="node" select=".."/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <fo:external-graphic>
+ <xsl:attribute name="src">
+ <xsl:call-template name="fo-external-image">
+ <xsl:with-param name="filename">
+ <xsl:if test="$img.src.path != '' and
+ not(starts-with($filename, '/')) and
+ not(contains($filename, '://'))">
+ <xsl:value-of select="$img.src.path"/>
+ </xsl:if>
+ <xsl:value-of select="$filename"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:attribute>
+
+ <xsl:attribute name="width">
+ <xsl:choose>
+ <xsl:when test="$ignore.image.scaling !=
0">auto</xsl:when>
+ <xsl:when test="contains(@width,'%')">
+ <xsl:value-of select="@width"/>
+ </xsl:when>
+ <xsl:when test="@width and not(@width = '')">
+ <xsl:call-template name="length-spec">
+ <xsl:with-param name="length" select="@width"/>
+ <xsl:with-param name="default.units"
select="'px'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="not(@depth) and $default.image.width !=
''">
+ <xsl:call-template name="length-spec">
+ <xsl:with-param name="length"
select="$default.image.width"/>
+ <xsl:with-param name="default.units"
select="'px'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>auto</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <xsl:attribute name="height">
+ <xsl:choose>
+ <xsl:when test="$ignore.image.scaling !=
0">auto</xsl:when>
+ <xsl:when test="contains(@depth,'%')">
+ <xsl:value-of select="@depth"/>
+ </xsl:when>
+ <xsl:when test="@depth">
+ <xsl:call-template name="length-spec">
+ <xsl:with-param name="length" select="@depth"/>
+ <xsl:with-param name="default.units"
select="'px'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>auto</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <xsl:attribute name="content-width">
+ <xsl:choose>
+ <xsl:when test="$ignore.image.scaling !=
0">auto</xsl:when>
+ <xsl:when test="contains(@contentwidth,'%')">
+ <xsl:value-of select="@contentwidth"/>
+ </xsl:when>
+ <xsl:when test="@contentwidth">
+ <xsl:call-template name="length-spec">
+ <xsl:with-param name="length"
select="@contentwidth"/>
+ <xsl:with-param name="default.units"
select="'px'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="number($scale) != 1.0">
+ <xsl:value-of select="$scale * 100"/>
+ <xsl:text>%</xsl:text>
+ </xsl:when>
+ <xsl:when test="$scalefit = 1">scale-to-fit</xsl:when>
+ <xsl:otherwise>auto</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <xsl:attribute name="content-height">
+ <xsl:choose>
+ <xsl:when test="$ignore.image.scaling !=
0">auto</xsl:when>
+ <xsl:when test="contains(@contentdepth,'%')">
+ <xsl:value-of select="@contentdepth"/>
+ </xsl:when>
+ <xsl:when test="@contentdepth">
+ <xsl:call-template name="length-spec">
+ <xsl:with-param name="length"
select="@contentdepth"/>
+ <xsl:with-param name="default.units"
select="'px'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="number($scale) != 1.0">
+ <xsl:value-of select="$scale * 100"/>
+ <xsl:text>%</xsl:text>
+ </xsl:when>
+ <xsl:when test="$scalefit = 1">scale-to-fit</xsl:when>
+ <xsl:otherwise>auto</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <xsl:if test="$content-type != ''">
+ <xsl:attribute name="content-type">
+ <xsl:value-of
select="concat('content-type:',$content-type)"/>
+ </xsl:attribute>
+ </xsl:if>
+
+ <xsl:if test="$bgcolor != ''">
+ <xsl:attribute name="background-color">
+ <xsl:value-of select="$bgcolor"/>
+ </xsl:attribute>
+ </xsl:if>
+
+ <xsl:if test="@align">
+ <xsl:attribute name="text-align">
+ <xsl:value-of select="@align"/>
+ </xsl:attribute>
+ </xsl:if>
+
+ <xsl:if test="@valign">
+ <xsl:attribute name="display-align">
+ <xsl:choose>
+ <xsl:when test="@valign =
'top'">before</xsl:when>
+ <xsl:when test="@valign =
'middle'">center</xsl:when>
+ <xsl:when test="@valign =
'bottom'">after</xsl:when>
+ <xsl:otherwise>auto</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ </fo:external-graphic>
+</xsl:template>
+
+</xsl:stylesheet>
Modified: trunk/docs/xslt/en/src/main/xslt/fopdf.xsl
===================================================================
--- trunk/docs/xslt/en/src/main/xslt/fopdf.xsl 2007-09-11 13:32:25 UTC (rev 2870)
+++ trunk/docs/xslt/en/src/main/xslt/fopdf.xsl 2007-09-11 13:35:34 UTC (rev 2871)
@@ -20,7 +20,6 @@
<!-- assume catalog-based resolution... -->
<xsl:import
href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.... />
-
<!-- ########## XRef -->
<!-- this controls whether xrefs have the title in it. We
@@ -282,10 +281,22 @@
</xsl:attribute-set>
<!-- Only hairlines as frame and cell borders in tables -->
<xsl:param
name="table.frame.border.thickness">0.1pt</xsl:param>
- <xsl:param
name="table.cell.border.thickness">0.1pt</xsl:param>
+ <xsl:param
name="table.cell.border.thickness">0.1pt</xsl:param>
+
+ <xsl:attribute-set name="table.table.properties">
+ <xsl:attribute
name="keep-together.within-column">auto</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.properties">
+ <xsl:attribute
name="keep-together.within-column">auto</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!--###################################################
+ Images
+ ################################################### -->
+
+
-
<!--###################################################
Labels
################################################### -->
@@ -455,17 +466,20 @@
<xsl:attribute name="padding-left">0.5em</xsl:attribute>
<xsl:attribute name="padding-right">0.5em</xsl:attribute>
<xsl:attribute name="padding-bottom">0.5em</xsl:attribute>
- <xsl:attribute name="margin-left">0.5em</xsl:attribute>
- <xsl:attribute name="margin-right">0.5em</xsl:attribute>
+ <xsl:attribute name="margin-left">0em</xsl:attribute>
+ <xsl:attribute name="margin-right">0em</xsl:attribute>
</xsl:attribute-set>
<!-- Shade (background) programlistings -->
- <xsl:param name="shade.verbatim">1</xsl:param>
+ <xsl:param name="shade.verbatim">1</xsl:param>
+ <xsl:param name="verbatim.margin.left">0pt</xsl:param>
<xsl:attribute-set name="shade.verbatim.style">
<xsl:attribute
name="background-color">#F0F0F0</xsl:attribute>
</xsl:attribute-set>
+ <xsl:attribute-set name="monospace.verbatim.properties">
+ <xsl:attribute name="wrap-option">wrap</xsl:attribute>
+ </xsl:attribute-set>
-
<!--###################################################
Callouts
################################################### -->
@@ -538,6 +552,7 @@
Turn this crap off. If you have to work with the "status"
attribute, don't.
-->
- <xsl:param name="draft.mode" select="'no'"/>
+ <xsl:param name="draft.mode" select="'no'"/>
+
</xsl:stylesheet>