You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by lt...@apache.org on 2007/06/24 23:02:50 UTC
svn commit: r550284 - in /maven/sandbox/trunk/doxia/doxia-module-fo: ./
src/main/java/org/apache/maven/doxia/module/fo/ src/main/resources/
src/test/java/org/apache/maven/doxia/module/fo/
Author: ltheussl
Date: Sun Jun 24 14:02:48 2007
New Revision: 550284
URL: http://svn.apache.org/viewvc?view=rev&rev=550284
Log:
Factor out configuration bits
Added:
maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoConfiguration.java (with props)
maven/sandbox/trunk/doxia/doxia-module-fo/src/main/resources/
maven/sandbox/trunk/doxia/doxia-module-fo/src/main/resources/fo-styles.xslt (with props)
maven/sandbox/trunk/doxia/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoConfigurationTest.java (with props)
Modified:
maven/sandbox/trunk/doxia/doxia-module-fo/pom.xml
maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
Modified: maven/sandbox/trunk/doxia/doxia-module-fo/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/doxia/doxia-module-fo/pom.xml?view=diff&rev=550284&r1=550283&r2=550284
==============================================================================
--- maven/sandbox/trunk/doxia/doxia-module-fo/pom.xml (original)
+++ maven/sandbox/trunk/doxia/doxia-module-fo/pom.xml Sun Jun 24 14:02:48 2007
@@ -51,12 +51,23 @@
<artifactId>doxia-sink-api</artifactId>
<version>${projectVersion}</version>
</dependency>
+ <dependency>
+ <groupId>commons-configuration</groupId>
+ <artifactId>commons-configuration</artifactId>
+ <version>1.4</version>
+ </dependency>
<!-- test dependencies -->
<dependency>
<groupId>fop</groupId>
<artifactId>fop</artifactId>
<version>0.93</version>
<classifier>jdk14</classifier>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- This should'n be needed, see DOXIA-101 -->
Added: maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoConfiguration.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoConfiguration.java?view=auto&rev=550284
==============================================================================
--- maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoConfiguration.java (added)
+++ maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoConfiguration.java Sun Jun 24 14:02:48 2007
@@ -0,0 +1,121 @@
+package org.apache.maven.doxia.module.fo;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.XMLConfiguration;
+
+
+/**
+ * A utility class to construct FO configuration parameters..
+ */
+public class FoConfiguration
+{
+
+ /** Holds the single attributes. */
+ private StringBuffer buffer;
+
+ /** The configuration instance. */
+ private final XMLConfiguration config;
+
+ /** The list of attribute sets. */
+ private final List sets;
+
+ // TODO: add constructor to override default configuration
+
+ /** Constructor. */
+ public FoConfiguration()
+ {
+ this.config = new XMLConfiguration();
+ // necessary because some attributes contain commas:
+ config.setDelimiterParsingDisabled( true );
+
+ try
+ {
+ config.load( getClass().getResourceAsStream( "/fo-styles.xslt" ) );
+ }
+ catch ( ConfigurationException cex )
+ {
+ throw new RuntimeException( cex ); // TODO
+ }
+
+ this.sets = config.getList( "xsl:attribute-set[@name]" );
+ reset();
+ }
+
+ /** Builds a list of attributes.
+ * @param attributeId A unique id to identify the set of attributes.
+ * This should correspond to the name of an attribute-set
+ * defined in the configuration file.
+ * @return A string that contains a list of attributes with
+ * the values configured for the current builder. Returns the
+ * empty string if attributeId is null or if attributeId
+ * is not a valid identifier.
+ */
+ public String getAttributeSet( String attributeId )
+ {
+ if ( attributeId == null )
+ {
+ return "";
+ }
+
+ reset();
+ addAttributes( attributeId );
+ return buffer.toString();
+ }
+
+ private void addAttributes( String attributeId )
+ {
+ int index = sets.indexOf( attributeId );
+ String keybase = "xsl:attribute-set(" + String.valueOf( index ) + ")";
+
+ Object prop = config.getProperty( keybase + ".xsl:attribute" );
+ if ( prop instanceof List )
+ {
+ List values = (List) prop;
+ List keys = config.getList( keybase + ".xsl:attribute[@name]" );
+ for ( int i = 0; i < values.size(); i++ )
+ {
+ buffer.append( " " + keys.get( i ) + "=\"" + values.get( i ) + "\"" );
+ }
+ }
+ else if ( prop instanceof String )
+ {
+ String value = config.getString( keybase + ".xsl:attribute" );
+ String key = config.getString( keybase + ".xsl:attribute[@name]" );
+ buffer.append( " " + key + "=\"" + value + "\"" );
+ }
+
+ String extend = config.getString( keybase + "[@use-attribute-sets]" );
+ if ( extend != null )
+ {
+ addAttributes( extend );
+ }
+ }
+
+ private void reset()
+ {
+ this.buffer = new StringBuffer( 512 );
+ }
+
+}
Propchange: maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoConfiguration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoConfiguration.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Modified: maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java?view=diff&rev=550284&r1=550283&r2=550284
==============================================================================
--- maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java (original)
+++ maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java Sun Jun 24 14:02:48 2007
@@ -41,6 +41,9 @@
/** Used to get the current position in numbered lists. */
private final Stack listStack = new Stack();
+ /** Used to get attributes for a given FO element. */
+ private final FoConfiguration config;
+
/** Counts the current section level. */
private int section = 0;
@@ -68,9 +71,9 @@
public FoSink( Writer writer )
{
this.out = new LineBreaker( writer );
+ this.config = new FoConfiguration();
}
- // TODO factor out all attributes and re-use them, configuration file?
// TODO page headers, page numbering
// TODO add aggregate mode?
// TODO add FOP compliance mode?
@@ -82,14 +85,20 @@
writeln( "<fo:root xmlns:fo=\"http://www.w3.org/1999/XSL/Format\">" );
- writeln( "<fo:layout-master-set>" );
- writeln( " <fo:simple-page-master margin-right=\"1in\" margin-left=\"1in\" margin-bottom=\"0.6in\" margin-top=\"0.625in\" page-height=\"11.70in\" page-width=\"8.25in\" master-name=\"body\">" );
- writeln( " <fo:region-body margin-bottom=\"0.8in\" margin-top=\"0.7in\"/><fo:region-before extent=\"0.35in\"/><fo:region-after extent=\"0.125in\"/>" );
- writeln( " </fo:simple-page-master>" );
- writeln( "</fo:layout-master-set>" );
- writeln( "" );
+ writeStartTag( "layout-master-set", null );
+ writeStartTag( "simple-page-master", "layout.master.set.body" );
+
+ writeEmptyTag( "region-body", "layout.master.set.body.region-body" );
+ writeEmptyTag( "region-before", "layout.master.set.body.region-before" );
+ writeEmptyTag( "region-after", "layout.master.set.body.region-after" );
+
+ writeEndTag( "simple-page-master" );
+ writeEndTag( "layout-master-set" );
+
+ newline();
writeln( "<fo:page-sequence initial-page-number=\"1\" master-reference=\"body\">" );
+
writeln( " <fo:flow flow-name=\"xsl-region-body\">" );
}
@@ -102,37 +111,37 @@
/** {@inheritDoc} */
public void title()
{
- lnwrite( "<fo:block text-align=\"center\" font-family=\"Garamond,serif\" font-size=\"16pt\" space-before.optimum=\"30pt\" space-after.optimum=\"14pt\">" );
+ writeStartTag( "block", "doc.header.title" );
}
/** {@inheritDoc} */
public void title_()
{
- writeln( "</fo:block>" );
+ writeEndTag( "block" );
}
/** {@inheritDoc} */
public void author()
{
- lnwrite( "<fo:block text-align=\"center\" font-family=\"Garamond,serif\" font-size=\"12pt\" space-before.optimum=\"20pt\" space-after.optimum=\"14pt\">" );
+ writeStartTag( "block", "doc.header.author" );
}
/** {@inheritDoc} */
public void author_()
{
- writeln( "</fo:block>" );
+ writeEndTag( "block" );
}
/** {@inheritDoc} */
public void date()
{
- lnwrite( "<fo:block text-align=\"center\" font-family=\"Garamond,serif\" font-size=\"12pt\" space-before.optimum=\"20pt\" space-after.optimum=\"30pt\">" );
+ writeStartTag( "block", "doc.header.date" );
}
/** {@inheritDoc} */
public void date_()
{
- writeln( "</fo:block>" );
+ writeEndTag( "block" );
}
/** {@inheritDoc} */
@@ -145,9 +154,9 @@
public void body_()
{
newline();
- writeln( " </fo:flow>" );
- writeln( "</fo:page-sequence>" );
- writeln( "</fo:root>" );
+ writeEndTag( "flow" );
+ writeEndTag( "page-sequence" );
+ writeEndTag( "root" );
flush();
close();
}
@@ -298,64 +307,55 @@
private void onSection()
{
newline();
- writeln( "<fo:block font-family=\"Garamond,serif\" font-size=\"11pt\" line-height=\"12pt\" white-space-collapse=\"true\">" );
+ writeStartTag( "block", "body.text" );
}
/** Starts a section title. */
private void onSectionTitle( int depth )
{
- String baseAttribs = "font-family=\"Helvetica,sans-serif\" color=\"#000000\" keep-with-next=\"always\" ";
- String levelAttribs = "";
-
StringBuffer title = new StringBuffer( 10 );
+ newline();
if ( depth == 1 )
{
- levelAttribs = "font-size=\"12pt\" font-weight=\"bold\" space-before=\"18pt\" space-after=\"6pt\"";
- title.append( section );
- title.append( " " );
+ writeStartTag( "block", "body.h1" );
+ title.append( section ).append( " " );
}
else if ( depth == 2 )
{
- levelAttribs = "font-size=\"9.5pt\" font-weight=\"bold\" space-before=\"18pt\" space-after=\"5pt\"";
- title.append( section );
- title.append( "." );
- title.append( subsection );
- title.append( " " );
+ writeStartTag( "block", "body.h2" );
+ title.append( section ).append( "." );
+ title.append( subsection ).append( " " );
}
else if ( depth == 3 )
{
- levelAttribs = "font-size=\"9.5pt\" font-weight=\"bold\" space-before=\"15pt\" space-after=\"3pt\"";
- title.append( section );
- title.append( "." );
- title.append( subsection );
- title.append( "." );
- title.append( subsubsection );
- title.append( " " );
+ writeStartTag( "block", "body.h3" );
+ title.append( section ).append( "." );
+ title.append( subsection ).append( "." );
+ title.append( subsubsection ).append( " " );
}
else if ( depth == 4 )
{
- levelAttribs = "font-size=\"9.5pt\" font-weight=\"bold\" space-before=\"9pt\" space-after=\"3pt\"";
+ writeStartTag( "block", "body.h4" );
}
else
{
- levelAttribs = "font-size=\"9.5pt\" font-weight=\"bold\" font-style=\"italic\" space-after=\"3pt\"";
+ writeStartTag( "block", "body.h5" );
}
- lnwrite( "<fo:block " + baseAttribs + levelAttribs + ">" );
write( title.toString() );
}
/** Ends a section title. */
private void onSectionTitle_()
{
- writeln( "</fo:block>" );
+ writeEndTag( "block" );
}
/** Ends a section/subsection. */
private void onSection_()
{
- writeln( "</fo:block>" );
+ writeEndTag( "block" );
}
// -----------------------------------------------------------------------
@@ -366,30 +366,31 @@
public void list()
{
newline();
- writeln( "<fo:list-block provisional-distance-between-starts=\"1em\" provisional-label-separation=\"1em\" start-indent=\"inherited-property-value(start-indent)\" space-before.optimum=\"10pt\">" );
+ writeStartTag( "list-block", "list" );
}
/** {@inheritDoc} */
public void list_()
{
- writeln( "</fo:list-block>" );
+ writeEndTag( "list-block" );
}
/** {@inheritDoc} */
public void listItem()
{
- writeln( " <fo:list-item space-before=\"0.15em\" space-after=\"0.25em\" start-indent=\"inherited-property-value(start-indent) + .5em\">" );
+ writeStartTag( "list-item", "list.item" );
+ // TODO customize?
writeln( " <fo:list-item-label><fo:block>•</fo:block></fo:list-item-label>" );
- writeln( " <fo:list-item-body start-indent=\"body-start()\">" );
- write( " <fo:block>" );
+ writeStartTag( "list-item-body", "list.item" );
+ writeStartTag( "block", null );
}
/** {@inheritDoc} */
public void listItem_()
{
- writeln( " </fo:block>" );
- writeln( " </fo:list-item-body>" );
- writeln( " </fo:list-item>" );
+ writeEndTag( "block" );
+ writeEndTag( "list-item-body" );
+ writeEndTag( "list-item" );
}
/** {@inheritDoc} */
@@ -397,14 +398,14 @@
{
listStack.push( new NumberedListItem( numbering ) );
newline();
- writeln( "<fo:list-block provisional-distance-between-starts=\"1em\" provisional-label-separation=\"1em\" start-indent=\"inherited-property-value(start-indent)\" space-before.optimum=\"10pt\">" );
+ writeStartTag( "list-block", "list" );
}
/** {@inheritDoc} */
public void numberedList_()
{
listStack.pop();
- writeln( "</fo:list-block>" );
+ writeEndTag( "list-block" );
}
/** {@inheritDoc} */
@@ -413,30 +414,37 @@
NumberedListItem current = (NumberedListItem) listStack.peek();
current.next();
- lnwrite( "<fo:list-item space-before=\"0.15em\" space-after=\"0.25em\" start-indent=\"inherited-property-value(start-indent) + .5em\">" );
- lnwrite( "<fo:list-item-label><fo:block>" );
+ writeStartTag( "list-item", "list.item" );
+
+ writeStartTag( "list-item-label", null );
+ writeStartTag( "block", null );
write( current.getListItemSymbol() );
- write( "</fo:block></fo:list-item-label>" );
- lnwrite( "<fo:list-item-body start-indent=\"body-start()\"><fo:block>" );
+ writeEndTag( "block" );
+ writeEndTag( "list-item-label" );
+
+ writeStartTag( "list-item-body", "list.item" );
+ writeStartTag( "block", null );
}
/** {@inheritDoc} */
public void numberedListItem_()
{
- writeln( "</fo:block></fo:list-item-body></fo:list-item>" );
+ writeEndTag( "block" );
+ writeEndTag( "list-item-body" );
+ writeEndTag( "list-item" );
}
/** {@inheritDoc} */
public void definitionList()
{
newline();
- writeln( "<fo:block start-indent=\"1em\" end-indent=\"1em\" space-before.optimum=\"10pt\">" );
+ writeStartTag( "block", "dl" );
}
/** {@inheritDoc} */
public void definitionList_()
{
- writeln( "</fo:block>" );
+ writeEndTag( "block" );
}
/** {@inheritDoc} */
@@ -454,40 +462,41 @@
/** {@inheritDoc} */
public void definedTerm()
{
- writeln( " <fo:block start-indent=\"1em\" end-indent=\"1em\" font-weight=\"bold\">" );
+ writeStartTag( "block", "dt" );
}
/** {@inheritDoc} */
public void definedTerm_()
{
- writeln( " </fo:block>" );
+ writeEndTag( "block" );
}
/** {@inheritDoc} */
public void definition()
{
newline();
- writeln( " <fo:block space-before=\"0.6em\" space-after=\"0.6em\" start-indent=\"inherited-property-value(start-indent) + 1em\" end-indent=\"inherited-property-value(start-indent) + 1em\">" );
+ writeStartTag( "block", "dd" );
}
/** {@inheritDoc} */
public void definition_()
{
- writeln( " </fo:block>" );
+ writeEndTag( "block" );
}
/** {@inheritDoc} */
public void figure()
{
newline();
- writeln( " <fo:block display-align=\"center\" text-align=\"center\">" );
- write( " <fo:external-graphic height=\"auto\" width=\"auto\" content-height=\"auto\" content-width=\"auto\" display-align=\"center\" text-align=\"center\"" );
+ writeStartTag( "block", "figure.display" );
+ write( "<fo:external-graphic"
+ + config.getAttributeSet( "figure.graphics" ) );
}
/** {@inheritDoc} */
public void figure_()
{
- writeln( " </fo:block>" );
+ writeEndTag( "block" );
}
/** {@inheritDoc} */
@@ -500,69 +509,55 @@
/** {@inheritDoc} */
public void figureCaption()
{
- lnwrite( " <fo:block keep-with-previous=\"always\" text-align=\"center\" font-family=\"Garamond,serif\" font-size=\"10pt\" font-style=\"italic\" space-before.optimum=\"20pt\" space-after.optimum=\"30pt\"> " );
+ writeStartTag( "block", "figure.caption" );
}
/** {@inheritDoc} */
public void figureCaption_()
{
- writeln( " </fo:block>" );
+ writeEndTag( "block" );
}
/** {@inheritDoc} */
public void paragraph()
{
- lnwrite( " <fo:block font-family=\"Garamond,serif\" font-size=\"11pt\" line-height=\"12pt\" white-space-collapse=\"true\" space-before.optimum=\"10pt\">" );
+ writeStartTag( "block", "normal.paragraph" );
}
/** {@inheritDoc} */
public void paragraph_()
{
- writeln( " </fo:block>" );
+ writeEndTag( "block" );
}
/** {@inheritDoc} */
public void verbatim( boolean boxed )
{
this.verbatim = true;
- StringBuffer buffer = new StringBuffer( 512 );
- buffer.append( " <fo:block font-family=\"monospace\" font-size=\"10pt\"" );
-
if ( boxed )
{
- buffer.append( " wrap-option=\"wrap\"" );
- buffer.append( " white-space-collapse=\"false\"" );
- buffer.append( " color=\"black\"" );
- buffer.append( " border-style=\"solid\"" );
- buffer.append( " border-width=\"0.5pt\"" );
- buffer.append( " border-color=\"#454545\"" );
- buffer.append( " padding-before=\"0.25em\"" );
- buffer.append( " padding-after=\"0.25em\"" );
- buffer.append( " padding-start=\"0.25em\"" );
- buffer.append( " padding-end=\"0.25em\"" );
- buffer.append( " start-indent=\"inherited-property-value(start-indent) + 2.5em\"" );
- buffer.append( " end-indent=\"inherited-property-value(end-indent) + 3em\"" );
- buffer.append( " space-before=\"0.75em\"" );
- buffer.append( " space-after=\"1em\"" );
+ writeStartTag( "block", "body.source" );
+ }
+ else
+ {
+ writeStartTag( "block", "body.pre" );
}
- buffer.append( ">" );
-
- writeln( buffer.toString() );
}
/** {@inheritDoc} */
public void verbatim_()
{
this.verbatim = false;
- writeln( " </fo:block>" );
+ writeEndTag( "block" );
}
/** {@inheritDoc} */
- /** {@inheritDoc} */
public void horizontalRule()
{
newline();
- writeln( " <fo:block line-height=\"1pt\"><fo:leader leader-length.optimum=\"100%\" leader-pattern=\"rule\" rule-thickness=\"0.5pt\" color=\"black\"/></fo:block>" );
+ writeStartTag( "block", null );
+ writeEmptyTag( "leader", "body.rule" );
+ writeEndTag( "block" );
}
/** {@inheritDoc} */
@@ -575,20 +570,23 @@
public void table()
{
newline();
- writeln( " <fo:block padding-before=\"9pt\" padding-after=\"12pt\">" );
+ writeStartTag( "block", "table.padding" );
+
// <fo:table-and-caption> is XSL-FO 1.0 standard but not implemented in FOP 0.93
- //writeln( " <fo:table-and-caption>" );
- // table-layout="auto" is not supported by FOP 0.93
- writeln( " <fo:table table-omit-footer-at-break=\"false\" table-layout=\"fixed\" width=\"100%\">" );
+ //writeStartTag( "table-and-caption", null );
+
+ writeStartTag( "table", "table.layout" );
}
/** {@inheritDoc} */
public void table_()
{
- writeln( " </fo:table>" );
+ writeEndTag( "table" );
+
// <fo:table-and-caption> is XSL-FO 1.0 standard but not implemented in FOP 0.93
- //writeln( " </fo:table-and-caption>" );
- writeln( " </fo:block>" );
+ //writeEndTag( "table-and-caption" );
+
+ writeEndTag( "block" );
}
/** {@inheritDoc} */
@@ -596,36 +594,40 @@
{
this.tableGrid = grid;
this.cellJustif = justification;
- // FOP hack to center the table, see http://xmlgraphics.apache.org/fop/fo.html#fo-center-table-horizon
+
+ // FOP hack to center the table, see
+ // http://xmlgraphics.apache.org/fop/fo.html#fo-center-table-horizon
writeln( " <fo:table-column column-width=\"proportional-column-width(1)\"/>" );
+
// TODO: calculate width[i]
for ( int i = 0; i < cellJustif.length; i++ )
{
writeln( " <fo:table-column column-width=\"1in\"/>" );
}
+
writeln( " <fo:table-column column-width=\"proportional-column-width(1)\"/>" );
- writeln( "<fo:table-body>" );
+ writeStartTag( "table-body", null );
}
/** {@inheritDoc} */
public void tableRows_()
{
this.cellJustif = null;
- writeln( "</fo:table-body>" );
+ writeEndTag( "table-body" );
}
/** {@inheritDoc} */
public void tableRow()
{
// TODO spacer rows
- writeln( "<fo:table-row keep-together=\"always\" keep-with-next=\"always\">" );
+ writeStartTag( "table-row", "table.body.row" );
this.cellCount = 0;
}
/** {@inheritDoc} */
public void tableRow_()
{
- writeln( "</fo:table-row>" );
+ writeEndTag( "table-row" );
}
/** {@inheritDoc} */
@@ -684,11 +686,11 @@
{
write( " border-style=\"solid\" border-width=\"0.2mm\"" );
}
- writeln( " padding-start=\"2.5pt\" padding-end=\"5pt\" padding-before=\"4pt\" padding-after=\"1.5pt\">" );
+ writeln( config.getAttributeSet( "table.body.cell" ) + ">" );
}
else
{
- writeln( "<fo:table-cell padding-start=\"2.5pt\" padding-end=\"5pt\" padding-before=\"4pt\" padding-after=\"1.5pt\">" );
+ writeStartTag( "table-cell", "table.body.cell" );
}
writeln( "<fo:block text-align=\"" + justif + "\">" );
}
@@ -696,8 +698,8 @@
/** {@inheritDoc} */
public void tableCell_()
{
- writeln( "</fo:block>" );
- writeln( "</fo:table-cell>" );
+ writeEndTag( "block" );
+ writeEndTag( "table-cell" );
++cellCount;
}
@@ -711,7 +713,8 @@
public void tableCaption()
{
// <fo:table-caption> is XSL-FO 1.0 standard but not implemented in FOP 0.93
- //lnwrite( "<fo:table-caption>" );
+ //writeStartTag( "table-caption", null );
+
// TODO: how to implement this otherwise?
// table-footer doesn't work because it has to be declared before table-body.
}
@@ -720,87 +723,91 @@
public void tableCaption_()
{
// <fo:table-caption> is XSL-FO 1.0 standard but not implemented in FOP 0.93
- //writeln( " </fo:table-caption>" );
+ //writeEndTag( "table-caption" );
}
/** {@inheritDoc} */
public void anchor( String name )
{
- lnwrite( " <fo:inline id=\"" + name + "\">" );
+ writeStartTag( "inline", "id", name );
}
/** {@inheritDoc} */
public void anchor_()
{
- write( " </fo:inline>" );
+ writeEndTag( "inline" );
}
/** {@inheritDoc} */
public void link( String name )
{
- if ( name.startsWith( "http", 0 ) || name.startsWith( "mailto", 0 ) || name.startsWith( "ftp", 0 ) )
+ if ( name.startsWith( "http", 0 ) || name.startsWith( "mailto", 0 )
+ || name.startsWith( "ftp", 0 ) )
{
- lnwrite( " <fo:basic-link external-destination=\"" + name + "\">" );
+ writeStartTag( "basic-link", "external-destination", name );
+ writeStartTag( "inline", "href.external" );
}
else if ( name.startsWith( "#", 0 ) )
{
- lnwrite( " <fo:basic-link internal-destination=\"" + name + "\">" );
+ writeStartTag( "basic-link", "internal-destination", name );
+ writeStartTag( "inline", "href.internal" );
}
else
{
// TODO: aggregate mode: link to another document, construct relative path
- lnwrite( "<fo:basic-link internal-destination=\"" + name + "\">" );
+ writeStartTag( "basic-link", "internal-destination", name );
+ writeStartTag( "inline", "href.internal" );
}
- write( " <fo:inline color=\"green\">" );
}
/** {@inheritDoc} */
public void link_()
{
- write( " </fo:inline></fo:basic-link>" );
+ writeEndTag( "inline" );
+ writeEndTag( "basic-link" );
}
/** {@inheritDoc} */
public void italic()
{
- lnwrite( " <fo:inline font-style=\"italic\">" );
+ writeStartTag( "inline", "italic" );
}
/** {@inheritDoc} */
public void italic_()
{
- writeln( " </fo:inline>" );
+ writeEndTag( "inline" );
}
/** {@inheritDoc} */
public void bold()
{
- lnwrite( " <fo:inline font-weight=\"bold\">" );
+ writeStartTag( "inline", "bold" );
}
/** {@inheritDoc} */
public void bold_()
{
- writeln( " </fo:inline>" );
+ writeEndTag( "inline" );
}
/** {@inheritDoc} */
public void monospaced()
{
- lnwrite( " <fo:inline font-family=\"monospace\" font-size=\"10pt\">" );
+ writeStartTag( "inline", "monospace" );
}
/** {@inheritDoc} */
public void monospaced_()
{
- writeln( " </fo:inline>" );
+ writeEndTag( "inline" );
}
/** {@inheritDoc} */
public void lineBreak()
{
newline();
- writeln( "<fo:block/>" );
+ writeEmptyTag( "block", null );
}
/** {@inheritDoc} */
@@ -838,21 +845,39 @@
//
// ----------------------------------------------------------------------
- private void write( String text )
+ private void writeStartTag( String tag, String attributeId )
{
- out.write( text, true );
+ String attribs = config.getAttributeSet( attributeId );
+ newline();
+ write( "<fo:" + tag + attribs + ">");
}
- private void writeln( String text )
+ private void writeStartTag( String tag, String id, String name )
{
- out.write( text, true );
newline();
+ write( "<fo:" + tag + " " + id + "=\"" + name + "\">");
}
- private void lnwrite( String text )
+ private void writeEndTag( String tag )
+ {
+ writeln( "</fo:" + tag + ">");
+ }
+
+ private void writeEmptyTag( String tag, String attributeId )
+ {
+ String attribs = config.getAttributeSet( attributeId );
+ writeln( "<fo:" + tag + attribs + "/>");
+ }
+
+ private void write( String text )
+ {
+ out.write( text, true );
+ }
+
+ private void writeln( String text )
{
- newline();
out.write( text, true );
+ newline();
}
private void content( String text )
Added: maven/sandbox/trunk/doxia/doxia-module-fo/src/main/resources/fo-styles.xslt
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/doxia/doxia-module-fo/src/main/resources/fo-styles.xslt?view=auto&rev=550284
==============================================================================
--- maven/sandbox/trunk/doxia/doxia-module-fo/src/main/resources/fo-styles.xslt (added)
+++ maven/sandbox/trunk/doxia/doxia-module-fo/src/main/resources/fo-styles.xslt Sun Jun 24 14:02:48 2007
@@ -0,0 +1,475 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ -->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
+
+ <!-- Layout master sets -->
+ <xsl:attribute-set name="layout.master.set.base">
+ <xsl:attribute name="page-width">8.25in</xsl:attribute>
+ <xsl:attribute name="page-height">11.70in</xsl:attribute>
+ <xsl:attribute name="margin-top">0.625in</xsl:attribute>
+ <xsl:attribute name="margin-bottom">0.6in</xsl:attribute>
+ <xsl:attribute name="margin-left">1in</xsl:attribute>
+ <xsl:attribute name="margin-right">1in</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="layout.master.set.cover-page" use-attribute-sets="layout.master.set.base">
+ <xsl:attribute name="master-name">cover-page</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="layout.master.set.cover-inside" use-attribute-sets="layout.master.set.base">
+ <xsl:attribute name="master-name">cover-inside</xsl:attribute>
+ <xsl:attribute name="margin-top">0in</xsl:attribute>
+ <xsl:attribute name="margin-bottom">0in</xsl:attribute>
+ <xsl:attribute name="margin-left">0in</xsl:attribute>
+ <xsl:attribute name="margin-right">0in</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="layout.master.set.toc" use-attribute-sets="layout.master.set.base">
+ <xsl:attribute name="master-name">toc</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="layout.master.set.body" use-attribute-sets="layout.master.set.base">
+ <xsl:attribute name="master-name">body</xsl:attribute>
+ </xsl:attribute-set>
+
+ <xsl:attribute-set name="layout.master.set.body.region-body">
+ <xsl:attribute name="margin-top">0.7in</xsl:attribute>
+ <xsl:attribute name="margin-bottom">0.8in</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="layout.master.set.body.region-before">
+ <xsl:attribute name="extent">0.35in</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="layout.master.set.body.region-after">
+ <xsl:attribute name="extent">0.125in</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Style 'primitives' from which all others are descended -->
+ <xsl:attribute-set name="base.body.style">
+ <xsl:attribute name="font-family">Garamond,serif</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="base.heading.style">
+ <xsl:attribute name="font-family">Helvetica,sans-serif</xsl:attribute>
+ <xsl:attribute name="color">#000000</xsl:attribute>
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="base.pre.style">
+ <xsl:attribute name="font-family">monospace</xsl:attribute>
+ </xsl:attribute-set>
+
+ <xsl:attribute-set name="italic">
+ <xsl:attribute name="font-style">italic</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="bold">
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="monospace">
+ <xsl:attribute name="font-family">monospace</xsl:attribute>
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Standard body and heading styles -->
+ <xsl:attribute-set name="body.text" use-attribute-sets="base.body.style">
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
+ <xsl:attribute name="line-height">12pt</xsl:attribute>
+ <xsl:attribute name="white-space-collapse">true</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="body.pre" use-attribute-sets="base.pre.style">
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="code.indent" use-attribute-sets="body.pre">
+ <xsl:attribute name="start-indent">inherited-property-value(start-indent) + 1em</xsl:attribute>
+ <xsl:attribute name="end-indent">inherited-property-value(end-indent) + 1em</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="body.source" use-attribute-sets="body.pre">
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
+ <xsl:attribute name="white-space-collapse">false</xsl:attribute>
+ <xsl:attribute name="color">black</xsl:attribute>
+ <xsl:attribute name="border-style">solid</xsl:attribute>
+ <xsl:attribute name="border-width">0.5pt</xsl:attribute>
+ <xsl:attribute name="border-color">#454545</xsl:attribute>
+ <xsl:attribute name="padding-before">0.25em</xsl:attribute>
+ <xsl:attribute name="padding-after">0.25em</xsl:attribute>
+ <xsl:attribute name="padding-start">0.25em</xsl:attribute>
+ <xsl:attribute name="padding-end">0.25em</xsl:attribute>
+ <xsl:attribute name="start-indent">inherited-property-value(start-indent) + 2.5em</xsl:attribute>
+ <xsl:attribute name="end-indent">inherited-property-value(end-indent) + 3em</xsl:attribute>
+ <xsl:attribute name="space-before">0.75em</xsl:attribute>
+ <xsl:attribute name="space-after">1em</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="body.rule">
+ <xsl:attribute name="leader-length.optimum">100%</xsl:attribute>
+ <xsl:attribute name="leader-pattern">rule</xsl:attribute>
+ <xsl:attribute name="rule-thickness">0.5pt</xsl:attribute>
+ <xsl:attribute name="color">black</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="body.strong">
+ <xsl:attribute name="font-family">Helvetica,sans-serif</xsl:attribute>
+ <xsl:attribute name="font-size">9.0pt</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="body.title" use-attribute-sets="base.heading.style">
+ <xsl:attribute name="font-size">16pt</xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="body.h1" use-attribute-sets="base.heading.style">
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ <xsl:attribute name="space-before">18pt</xsl:attribute>
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="body.h2" use-attribute-sets="base.heading.style">
+ <xsl:attribute name="font-size">9.5pt</xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ <xsl:attribute name="space-before">18pt</xsl:attribute>
+ <xsl:attribute name="space-after">5pt</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="body.h3" use-attribute-sets="base.heading.style">
+ <xsl:attribute name="font-size">9.5pt</xsl:attribute>
+ <xsl:attribute name="space-before">15pt</xsl:attribute>
+ <xsl:attribute name="space-after">3pt</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="body.h4" use-attribute-sets="base.heading.style">
+ <xsl:attribute name="font-size">9.5pt</xsl:attribute>
+ <xsl:attribute name="space-before">9pt</xsl:attribute>
+ <xsl:attribute name="space-after">3pt</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="body.h5" use-attribute-sets="base.heading.style">
+ <xsl:attribute name="font-size">9.5pt</xsl:attribute>
+ <xsl:attribute name="font-style">italic</xsl:attribute>
+ <xsl:attribute name="space-after">3pt</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Chapter heading styles -->
+ <xsl:attribute-set name="chapter.title" use-attribute-sets="base.heading.style body.title">
+ <xsl:attribute name="line-height">10pt</xsl:attribute>
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="chapter.rule">
+ <xsl:attribute name="leader-length.optimum">100%</xsl:attribute>
+ <xsl:attribute name="leader-pattern">dots</xsl:attribute>
+ <xsl:attribute name="rule-thickness">1pt</xsl:attribute>
+ <xsl:attribute name="color">#454545</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Outdented numbers -->
+ <xsl:attribute-set name="outdented.number.style" use-attribute-sets="base.heading.style">
+ <xsl:attribute name="font-size">9.5pt</xsl:attribute>
+ <xsl:attribute name="color">#454545</xsl:attribute>
+ <xsl:attribute name="line-height">10pt</xsl:attribute>
+ <xsl:attribute name="text-align">right</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Page header/footer styles -->
+ <xsl:attribute-set name="footer.style">
+ <xsl:attribute name="letter-spacing">2pt</xsl:attribute>
+ <xsl:attribute name="font-family">Helvetica,sans-serif</xsl:attribute>
+ <xsl:attribute name="font-size">6pt</xsl:attribute>
+ <xsl:attribute name="color">#454545</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="header.style">
+ <xsl:attribute name="letter-spacing">2pt</xsl:attribute>
+ <xsl:attribute name="font-family">Helvetica,sans-serif</xsl:attribute>
+ <xsl:attribute name="font-size">6pt</xsl:attribute>
+ <xsl:attribute name="color">#454545</xsl:attribute>
+ <xsl:attribute name="text-align">left</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="page.number">
+ <xsl:attribute name="font-family">Helvetica,sans-serif</xsl:attribute>
+ <xsl:attribute name="font-size">9.5pt</xsl:attribute>
+ <xsl:attribute name="text-align">right</xsl:attribute>
+ <xsl:attribute name="color">black</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Style for hyperlinks -->
+ <xsl:attribute-set name="href.internal">
+ <xsl:attribute name="color">blue</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="href.external">
+ <xsl:attribute name="color">green</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- 'Normal' line-spacing styles for paragraph and pre elements -->
+ <xsl:attribute-set name="normal.paragraph" use-attribute-sets="body.text">
+ <xsl:attribute name="space-before">3pt</xsl:attribute>
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Styles for lists, list items, definition lists, etc. -->
+ <xsl:attribute-set name="list">
+ <xsl:attribute name="start-indent">inherited-property-value(start-indent)</xsl:attribute>
+ <xsl:attribute name="space-before.optimum">10pt</xsl:attribute>
+ <xsl:attribute name="provisional-distance-between-starts">1em</xsl:attribute>
+ <xsl:attribute name="provisional-label-separation">1em</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="list.item">
+ <xsl:attribute name="start-indent">inherited-property-value(start-indent) + 1em</xsl:attribute>
+ <xsl:attribute name="space-before">0.15em</xsl:attribute>
+ <xsl:attribute name="space-after">0.25em</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="dl" use-attribute-sets="body.text">
+ <xsl:attribute name="start-indent">1em</xsl:attribute>
+ <xsl:attribute name="end-indent">1em</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="dt" use-attribute-sets="base.body.style">
+ <xsl:attribute name="start-indent">1em</xsl:attribute>
+ <xsl:attribute name="end-indent">1em</xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="dd" use-attribute-sets="base.body.style">
+ <xsl:attribute name="start-indent">inherited-property-value(start-indent) + 1em</xsl:attribute>
+ <xsl:attribute name="end-indent">inherited-property-value(end-indent) + 1em</xsl:attribute>
+ <xsl:attribute name="space-before">0.6em</xsl:attribute>
+ <xsl:attribute name="space-after">0.6em</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Error style -->
+ <xsl:attribute-set name="error.block" use-attribute-sets="base.block">
+ <xsl:attribute name="font-size">8pt</xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ <xsl:attribute name="color">red</xsl:attribute>
+ <xsl:attribute name="border-style">solid</xsl:attribute>
+ <xsl:attribute name="border-width">0.5pt</xsl:attribute>
+ <xsl:attribute name="border-color">red</xsl:attribute>
+ <xsl:attribute name="padding">0.75em</xsl:attribute>
+ <xsl:attribute name="start-indent">inherited-property-value(start-indent) + 2.5em</xsl:attribute>
+ <xsl:attribute name="end-indent">inherited-property-value(end-indent) + 3em</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- cover styles -->
+ <xsl:attribute-set name="cover.title">
+ <xsl:attribute name="font-family">Helvetica,sans-serif</xsl:attribute>
+ <xsl:attribute name="color">#000000</xsl:attribute>
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
+ <xsl:attribute name="font-size">16pt</xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="cover.subtitle">
+ <xsl:attribute name="font-family">Helvetica,sans-serif</xsl:attribute>
+ <xsl:attribute name="color">#000000</xsl:attribute>
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="cover.border.left" use-attribute-sets="base.pre.style">
+ <xsl:attribute name="padding-start">0.2in</xsl:attribute>
+ <xsl:attribute name="border-left-style">dotted</xsl:attribute>
+ <xsl:attribute name="border-left-width">0.1pt</xsl:attribute>
+ <xsl:attribute name="border-left-color">#000000</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="cover.border.left.bottom" use-attribute-sets="cover.border.left">
+ <xsl:attribute name="padding-after">0.2in</xsl:attribute>
+ <xsl:attribute name="border-bottom-style">dotted</xsl:attribute>
+ <xsl:attribute name="border-bottom-width">0.1pt</xsl:attribute>
+ <xsl:attribute name="border-bottom-color">#000000</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Header styles (ie title, author, date in single document mode) -->
+ <xsl:attribute-set name="doc.header.title" use-attribute-sets="base.body.style">
+ <xsl:attribute name="text-align">center</xsl:attribute>
+ <xsl:attribute name="font-size">16pt</xsl:attribute>
+ <xsl:attribute name="space-before.optimum">30pt</xsl:attribute>
+ <xsl:attribute name="space-after.optimum">14pt</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="doc.header.author" use-attribute-sets="base.body.style">
+ <xsl:attribute name="text-align">center</xsl:attribute>
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
+ <xsl:attribute name="space-before.optimum">20pt</xsl:attribute>
+ <xsl:attribute name="space-after.optimum">14pt</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="doc.header.date" use-attribute-sets="base.body.style">
+ <xsl:attribute name="text-align">center</xsl:attribute>
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
+ <xsl:attribute name="space-before.optimum">20pt</xsl:attribute>
+ <xsl:attribute name="space-after.optimum">30pt</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Figure styles -->
+ <xsl:attribute-set name="figure.display">
+ <xsl:attribute name="display-align">center</xsl:attribute>
+ <xsl:attribute name="text-align">center</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="figure.graphics">
+ <xsl:attribute name="height">auto</xsl:attribute>
+ <xsl:attribute name="width">auto</xsl:attribute>
+ <xsl:attribute name="content-height">auto</xsl:attribute>
+ <xsl:attribute name="content-width">auto</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="figure.caption" use-attribute-sets="base.body.style">
+ <xsl:attribute name="keep-with-previous">always</xsl:attribute>
+ <xsl:attribute name="text-align">center</xsl:attribute>
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
+ <xsl:attribute name="font-style">italic</xsl:attribute>
+ <xsl:attribute name="space-before.optimum">20pt</xsl:attribute>
+ <xsl:attribute name="space-after.optimum">30pt</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Tables styles -->
+ <xsl:attribute-set name="table.layout">
+ <xsl:attribute name="table-omit-footer-at-break">false</xsl:attribute>
+ <!-- note that table-layout="auto" is not supported by FOP 0.93 -->
+ <xsl:attribute name="table-layout">fixed</xsl:attribute>
+ <xsl:attribute name="width">100%</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.heading.rule">
+ <xsl:attribute name="leader-length.optimum">100%</xsl:attribute>
+ <xsl:attribute name="leader-pattern">rule</xsl:attribute>
+ <xsl:attribute name="rule-thickness">0.5pt</xsl:attribute>
+ <xsl:attribute name="color">black</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="base.cell">
+ <xsl:attribute name="padding-start">2.5pt</xsl:attribute>
+ <xsl:attribute name="padding-end">5pt</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="base.block">
+ <xsl:attribute name="font-family">Helvetica,sans-serif</xsl:attribute>
+ <xsl:attribute name="line-height">1.2em</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.padding">
+ <xsl:attribute name="padding-before">9pt</xsl:attribute>
+ <xsl:attribute name="padding-after">12pt</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.title.row">
+ <xsl:attribute name="keep-together">always</xsl:attribute>
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.title.cell" use-attribute-sets="base.cell">
+ <xsl:attribute name="border-after-style">solid</xsl:attribute>
+ <xsl:attribute name="border-after-width">0.5pt</xsl:attribute>
+ <xsl:attribute name="border-after-color">black</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.title.block" use-attribute-sets="base.block">
+ <xsl:attribute name="font-size">9.5pt</xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.footer.cell" use-attribute-sets="base.cell">
+ <xsl:attribute name="padding-before">5pt</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.footer.block" use-attribute-sets="base.block">
+ <xsl:attribute name="font-size">7pt</xsl:attribute>
+ <xsl:attribute name="font-style">italic</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.heading.cell" use-attribute-sets="base.cell">
+ <xsl:attribute name="padding-before">7pt</xsl:attribute>
+ <xsl:attribute name="display-align">after</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.heading.block" use-attribute-sets="base.block">
+ <xsl:attribute name="font-size">8pt</xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.heading.rule">
+ <xsl:attribute name="leader-length.optimum">100%</xsl:attribute>
+ <xsl:attribute name="leader-pattern">rule</xsl:attribute>
+ <xsl:attribute name="rule-thickness">0.5pt</xsl:attribute>
+ <xsl:attribute name="color">black</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.number.cell" use-attribute-sets="base.cell">
+ <xsl:attribute name="padding-before">6pt</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.number.block" use-attribute-sets="base.block">
+ <xsl:attribute name="font-size">7pt</xsl:attribute>
+ <xsl:attribute name="font-style">italic</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.subheading.row">
+ <xsl:attribute name="keep-together">always</xsl:attribute>
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.subheading.cell" use-attribute-sets="base.cell">
+ <xsl:attribute name="padding-after">1pt</xsl:attribute>
+ <xsl:attribute name="background-color">#D3D3D3</xsl:attribute>
+ <xsl:attribute name="border-before-style">solid</xsl:attribute>
+ <xsl:attribute name="border-before-width">2.5pt</xsl:attribute>
+ <xsl:attribute name="border-before-color">#D3D3D3</xsl:attribute>
+ <xsl:attribute name="display-align">after</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.subheading.block" use-attribute-sets="base.block">
+ <xsl:attribute name="font-size">7pt</xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ <xsl:attribute name="vertical-align">bottom</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.body.row">
+ <xsl:attribute name="keep-together">always</xsl:attribute>
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.body.norule">
+ <xsl:attribute name="leader-length.optimum">100%</xsl:attribute>
+ <xsl:attribute name="leader-pattern">rule</xsl:attribute>
+ <xsl:attribute name="rule-thickness">1pt</xsl:attribute>
+ <xsl:attribute name="color">white</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.body.rule">
+ <xsl:attribute name="leader-length.optimum">100%</xsl:attribute>
+ <xsl:attribute name="leader-pattern">dots</xsl:attribute>
+ <xsl:attribute name="rule-thickness">0.5pt</xsl:attribute>
+ <xsl:attribute name="color">#A9A9A9</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.body.lastrule">
+ <xsl:attribute name="leader-length.optimum">100%</xsl:attribute>
+ <xsl:attribute name="leader-pattern">rule</xsl:attribute>
+ <xsl:attribute name="rule-thickness">0.5pt</xsl:attribute>
+ <xsl:attribute name="color">black</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.body.cell" use-attribute-sets="base.cell">
+ <xsl:attribute name="padding-before">4pt</xsl:attribute>
+ <xsl:attribute name="padding-after">1.5pt</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.body.block" use-attribute-sets="base.block">
+ <xsl:attribute name="font-size">7pt</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="table.pre" use-attribute-sets="base.pre.style">
+ <xsl:attribute name="font-size">7pt</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Table of content styles -->
+ <xsl:attribute-set name="toc.cell">
+ <xsl:attribute name="display-align">after</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="toc.base.style">
+ <xsl:attribute name="font-family">Helvetica,sans-serif</xsl:attribute>
+ <xsl:attribute name="line-height">16pt</xsl:attribute>
+ <xsl:attribute name="text-align-last">start</xsl:attribute>
+ <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="toc.leader.style">
+ <xsl:attribute name="leader-pattern">dots</xsl:attribute>
+ <xsl:attribute name="leader-pattern-width">5pt</xsl:attribute>
+ <xsl:attribute name="color">#454545</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="toc.number.style">
+ <xsl:attribute name="font-size">9.5pt</xsl:attribute>
+ <xsl:attribute name="text-align">end</xsl:attribute>
+ <xsl:attribute name="color">#A9A9A9</xsl:attribute>
+ <xsl:attribute name="line-height">16pt</xsl:attribute>
+ <xsl:attribute name="end-indent">6pt</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="toc.h1.style" use-attribute-sets="toc.base.style">
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ <xsl:attribute name="space-before">18pt</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="toc.h2.style" use-attribute-sets="toc.base.style">
+ <xsl:attribute name="font-size">9.5pt</xsl:attribute>
+ <xsl:attribute name="space-before">15pt</xsl:attribute>
+ <xsl:attribute name="space-before">3pt</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="toc.h3.style" use-attribute-sets="toc.base.style">
+ <xsl:attribute name="font-size">9.5pt</xsl:attribute>
+ <xsl:attribute name="space-before">4pt</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="toc.h4.style" use-attribute-sets="toc.base.style">
+ <xsl:attribute name="font-size">9.5pt</xsl:attribute>
+ <xsl:attribute name="space-before">4pt</xsl:attribute>
+ </xsl:attribute-set>
+</xsl:stylesheet>
Propchange: maven/sandbox/trunk/doxia/doxia-module-fo/src/main/resources/fo-styles.xslt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/sandbox/trunk/doxia/doxia-module-fo/src/main/resources/fo-styles.xslt
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/sandbox/trunk/doxia/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoConfigurationTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/doxia/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoConfigurationTest.java?view=auto&rev=550284
==============================================================================
--- maven/sandbox/trunk/doxia/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoConfigurationTest.java (added)
+++ maven/sandbox/trunk/doxia/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoConfigurationTest.java Sun Jun 24 14:02:48 2007
@@ -0,0 +1,47 @@
+package org.apache.maven.doxia.module.fo;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import junit.framework.TestCase;
+
+/** FoConfiguration tests. */
+public class FoConfigurationTest extends TestCase
+{
+
+ /** Tests the getAttributes( String ) method. */
+ public void testGetAttributes()
+ {
+ FoConfiguration attributes = new FoConfiguration();
+
+ assertEquals(
+ "Null attribute ID should return empty string!",
+ "", attributes.getAttributeSet( null ) );
+
+ assertEquals(
+ "Non existent attribute ID should return empty string!",
+ "", attributes.getAttributeSet( "a.dummy.attribute" ) );
+
+ assertEquals(
+ "Wrong attributes returned!",
+ " font-size=\"10pt\" font-family=\"monospace\"",
+ attributes.getAttributeSet( "body.pre" ) );
+ }
+
+}
Propchange: maven/sandbox/trunk/doxia/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoConfigurationTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/sandbox/trunk/doxia/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoConfigurationTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"