[hibernate-commits] Hibernate SVN: r11464 - in trunk/sandbox/maven-poc/plugins/docbook: src/main/java/org/jboss/maven/docbook/gen and 9 other directories.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Fri May 4 00:41:23 EDT 2007
Author: steve.ebersole at jboss.com
Date: 2007-05-04 00:41:23 -0400 (Fri, 04 May 2007)
New Revision: 11464
Added:
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/BaselineHandler.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ContentItem.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ContentItemDescriptor.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/Diff.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/DiffCreator.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/GenerationException.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ReportGenerator.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationDiffReport.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationHandler.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/resources/META-INF/plexus/
trunk/sandbox/maven-poc/plugins/docbook/src/main/resources/META-INF/plexus/components.xml
trunk/sandbox/maven-poc/plugins/docbook/src/main/resources/translation-diff-report.properties
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt/
Removed:
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElement.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementState.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementsComparator.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementsExtractor.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleReport.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleReportHTML.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/RevisionDiffMojo.java
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style/
Modified:
trunk/sandbox/maven-poc/plugins/docbook/pom.xml
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/GenerationMojo.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/FormatterSupport.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/TranslationRenderer.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/xslt/TransformerFactory.java
trunk/sandbox/maven-poc/plugins/docbook/src/test/java/org/jboss/maven/docbook/gen/RendererTest.java
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt/fopdf.xsl
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt/html.xsl
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt/html_chunk.xsl
Log:
semi happy with this although the diff report thing is still a tad broken
Modified: trunk/sandbox/maven-poc/plugins/docbook/pom.xml
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/pom.xml 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/pom.xml 2007-05-04 04:41:23 UTC (rev 11464)
@@ -29,31 +29,66 @@
<version>2.0</version>
</dependency>
<dependency>
- <groupId>xml-resolver</groupId>
- <artifactId>xml-resolver</artifactId>
- <version>1.1</version>
+ <groupId>org.apache.maven.reporting</groupId>
+ <artifactId>maven-reporting-impl</artifactId>
+ <version>2.0.4</version>
</dependency>
<dependency>
+ <groupId>org.apache.maven.reporting</groupId>
+ <artifactId>maven-reporting-api</artifactId>
+ <version>2.0.4</version>
+ </dependency>
+ <dependency>
<groupId>plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
- <groupId>fop</groupId>
- <artifactId>fop</artifactId>
- <version>0.20.5</version>
- </dependency>
- <dependency>
<groupId>avalon-framework</groupId>
<artifactId>avalon-framework</artifactId>
<version>4.1.5</version>
</dependency>
<dependency>
- <groupId>saxon</groupId>
- <artifactId>saxon</artifactId>
- <version>6.5.3</version>
+ <groupId>org.apache.maven.doxia</groupId>
+ <artifactId>doxia-core</artifactId>
+ <version>${doxiaVersion}</version>
</dependency>
<dependency>
+ <groupId>org.apache.maven.doxia</groupId>
+ <artifactId>doxia-decoration-model</artifactId>
+ <version>${doxiaSiteVersion}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-container-default</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.doxia</groupId>
+ <artifactId>doxia-site-renderer</artifactId>
+ <version>${doxiaSiteVersion}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-container-default</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>xml-resolver</groupId>
+ <artifactId>xml-resolver</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.8.0</version>
@@ -66,6 +101,16 @@
<scope>runtime</scope>
</dependency>
<dependency>
+ <groupId>saxon</groupId>
+ <artifactId>saxon</artifactId>
+ <version>6.5.3</version>
+ </dependency>
+ <dependency>
+ <groupId>fop</groupId>
+ <artifactId>fop</artifactId>
+ <version>0.20.5</version>
+ </dependency>
+ <dependency>
<groupId>javax.media</groupId>
<artifactId>jai-core</artifactId>
<version>1.1.2</version>
@@ -90,17 +135,9 @@
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.4</source>
- <target>1.4</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <properties>
+ <doxiaVersion>1.0-alpha-8</doxiaVersion>
+ <doxiaSiteVersion>1.0-alpha-8</doxiaSiteVersion>
+ </properties>
</project>
Modified: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/GenerationMojo.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/GenerationMojo.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/GenerationMojo.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -6,7 +6,6 @@
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
-import org.jboss.maven.docbook.gen.Settings;
import org.jboss.maven.docbook.gen.rendering.MainRenderer;
import org.jboss.maven.docbook.gen.rendering.RenderingException;
import org.jboss.maven.docbook.gen.rendering.FormatterFactory;
@@ -19,37 +18,30 @@
* specifically handles language translations in a more transparent way.
*
* @goal generate
- * @phase generate-sources
+ * @phase package
*
* @author Steve Ebersole
*/
public class GenerationMojo extends AbstractMojo {
/**
- * The directory where the DocBook sources and translations can be found.
- *
- * @parameter expression="${basedir}/src/main/docbook"
- */
- private File sourcesDirectory;
-
- /**
* The directory containing default (i.e. language-agnostic) shared resources.
*
- * @parameter expression="${sourcesDirectory}/standard/resources"
+ * @parameter expression="${basedir}/src/main/docbook/standard/resources"
*/
private File standardResourcesDirectory;
/**
* The directory containing the default (i.e. language-agnostic) XSLT stylesheets.
*
- * @parameter expression="${sourcesDirectory}/standard/style"
+ * @parameter expression="${basedir}/src/main/docbook/standard/xslt"
*/
private File standardStylesheetDirectory;
/**
* The directory containing the translated DocBook sources.
*
- * @parameter expression="${sourcesDirectory}/translations"
+ * @parameter expression="${basedir}/src/main/docbook/translations"
*/
private File translationsDirectory;
Modified: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/FormatterSupport.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/FormatterSupport.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/FormatterSupport.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -126,7 +126,16 @@
protected Transformer buildTransformer(File targetFile) throws RenderingException {
final URL docbookStylesheet = format.isChunkedOutput() ? getChunkedStyleSheetUrl() : getDefaultStylesheetUrl();
final URL transformationStylesheet = resolveTransformationStylesheet();
- return getSettings().getTransformerFactory().buildTransformer( docbookStylesheet, transformationStylesheet );
+ Transformer transformer = getSettings().getTransformerFactory()
+ .buildTransformer( docbookStylesheet, transformationStylesheet );
+ // "inclusion" of graphics in html is much different than other formats
+ // REF: http://sagehill.net/docbookxsl/GraphicsLocations.html
+ if ( ! StandardDocBookFormatType.HTML.getName().equals( format.getFormatName() ) ) {
+ String imgSrcPath = translationRenderer.getTranslationTargetDirectory().getAbsolutePath() + "/";
+ getLog().debug( "setting 'img.src.path' [" + imgSrcPath + "]" );
+ transformer.setParameter( "img.src.path", imgSrcPath );
+ }
+ return transformer;
}
private Source buildSource(File sourceFile) throws RenderingException {
@@ -134,7 +143,7 @@
EntityResolver resolver = getSettings().getTransformerFactory().getCatalogResolver();
if ( getSettings().getEntities() != null ) {
resolver = new InjectingEntityResolver(
- java.util.Arrays.asList( getSettings().getEntities() ),
+ getSettings().getEntities(),
resolver,
format.getFormatName(),
translationRenderer.getMainRenderer().getSettings().getLog()
Modified: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/TranslationRenderer.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/TranslationRenderer.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/TranslationRenderer.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -71,7 +71,9 @@
for ( int i = 0; i < matched.length; i++ ) {
final File source = new File( translationSourceDirectory, matched[i] );
- mainRenderer.getSettings().getFormatterFactory().buildFormatter( this, formats[i] ).format( source );
+ for ( int x = 0; x < formats.length; x++ ) {
+ mainRenderer.getSettings().getFormatterFactory().buildFormatter( this, formats[x] ).format( source );
+ }
}
}
Modified: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/xslt/TransformerFactory.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/xslt/TransformerFactory.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/xslt/TransformerFactory.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -1,6 +1,7 @@
package org.jboss.maven.docbook.gen.xslt;
import java.io.IOException;
+import java.io.File;
import java.net.URL;
import java.util.Enumeration;
import java.util.Iterator;
@@ -68,9 +69,13 @@
}
try {
- javax.xml.transform.TransformerFactory transformerFactory = transformerType == TransformerType.XALAN
- ? new com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl()
- : new com.icl.saxon.TransformerFactoryImpl();
+ javax.xml.transform.TransformerFactory transformerFactory;
+ if ( transformerType == TransformerType.XALAN ) {
+ transformerFactory = new com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl();
+ }
+ else {
+ transformerFactory = new com.icl.saxon.TransformerFactoryImpl();
+ }
transformerFactory.setURIResolver( uriResolver );
Source source = new StreamSource( xsltStylesheet.openStream(), xsltStylesheet.toExternalForm() );
Transformer transformer = transformerFactory.newTransformer( source );
Added: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/BaselineHandler.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/BaselineHandler.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/BaselineHandler.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,61 @@
+package org.jboss.maven.docbook.revdiff;
+
+import java.util.Map;
+import java.net.URL;
+import java.net.MalformedURLException;
+
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * An XML parse handler used to create a catalog of baseline elements.
+ * <p/>
+ * Typically this would be used against the master translation to create
+ * a baseline against which particular translations would be checked.
+ *
+ * @author Christian Bauer
+ * @author Steve Ebersole
+ */
+public class BaselineHandler extends DefaultHandler {
+ private final Map catalog;
+ private Locator docLocator;
+
+ public void setDocumentLocator(Locator locator) {
+ this.docLocator = locator;
+ }
+
+ public BaselineHandler(Map catalog) {
+ this.catalog = catalog;
+ }
+
+ public void startElement(
+ String namespaceURI,
+ String localName,
+ String qualifiedName,
+ Attributes atts) throws SAXException {
+
+ // Only add ModuleElements that have an identifier
+ String identifier = atts.getValue( "id" );
+ if ( identifier != null ) {
+ // The default revision is 0
+ int revision = 0;
+ if ( atts.getValue( "revision" ) != null ) {
+ revision = new Integer( atts.getValue( "revision" ) ).intValue();
+ }
+
+ // Generate new ContentItem and new original state
+ ContentItem contentItem = new ContentItem( identifier );
+ ContentItemDescriptor descriptor = new ContentItemDescriptor(
+ docLocator.getSystemId(),
+ qualifiedName,
+ revision,
+ docLocator.getLineNumber(),
+ docLocator.getColumnNumber()
+ );
+ contentItem.setMasterDescriptor( descriptor );
+ catalog.put( identifier, contentItem );
+ }
+ }
+}
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ContentItem.java (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElement.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ContentItem.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ContentItem.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,59 @@
+package org.jboss.maven.docbook.revdiff;
+
+/**
+ * Describes a particular piece of content, including descriptors
+ * from both the master and a particular translation
+ *
+ * @author Christian Bauer
+ */
+public class ContentItem {
+ private final String identifier;
+ private ContentItemDescriptor masterDescriptor;
+ private ContentItemDescriptor translationDescriptor;
+
+ public ContentItem(String identifier) {
+ this.identifier = identifier;
+ }
+
+ public String getIdentifier() {
+ return identifier;
+ }
+
+ public ContentItemDescriptor getMasterDescriptor() {
+ return masterDescriptor;
+ }
+
+ public void setMasterDescriptor(ContentItemDescriptor masterDescriptor) {
+ this.masterDescriptor = masterDescriptor;
+ }
+
+ public ContentItemDescriptor getTranslationDescriptor() {
+ return translationDescriptor;
+ }
+
+ public void setTranslationDescriptor(ContentItemDescriptor translationDescriptor) {
+ this.translationDescriptor = translationDescriptor;
+ }
+
+
+ public boolean equals(Object o) {
+ if ( this == o ) {
+ return true;
+ }
+ if ( o == null || getClass() != o.getClass() ) {
+ return false;
+ }
+
+ ContentItem that = ( ContentItem ) o;
+
+ if ( !identifier.equals( that.identifier ) ) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ return identifier.hashCode();
+ }
+}
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ContentItemDescriptor.java (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementState.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ContentItemDescriptor.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ContentItemDescriptor.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,44 @@
+package org.jboss.maven.docbook.revdiff;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Christian Bauer
+ */
+public class ContentItemDescriptor {
+ public static int REVISION_IGNORE = -1;
+
+ private final String sourceSystemId;
+ private final String elementName;
+ private final int revision;
+ private final int row;
+ private final int column;
+
+ public ContentItemDescriptor(String sourceSystemId, String elementName, int revision, int row, int column) {
+ this.sourceSystemId = sourceSystemId;
+ this.elementName = elementName;
+ this.revision = revision;
+ this.row = row;
+ this.column = column;
+ }
+
+ public int getRevision() {
+ return revision;
+ }
+
+ public String getElementName() {
+ return elementName;
+ }
+
+ public String getSourceSystemId() {
+ return sourceSystemId;
+ }
+
+ public int getRow() {
+ return row;
+ }
+
+ public int getColumn() {
+ return column;
+ }
+}
Added: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/Diff.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/Diff.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/Diff.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,39 @@
+package org.jboss.maven.docbook.revdiff;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+
+/**
+ * Represents the difference between two sources.
+ *
+ * @author Steve Ebersole
+ */
+public class Diff {
+ private Set elementsOnlyInMaster = new HashSet();
+ private Set elementsOnlyInTranslation = new HashSet();
+ private Set elementsDiffRevision = new HashSet();
+
+ public void addOnlyInMaster(ContentItem element) {
+ elementsOnlyInMaster.add( element );
+ }
+
+ public void addOnlyInTranslation(ContentItem element) {
+ elementsOnlyInTranslation.add( element );
+ }
+
+ public void addDiffRevision(ContentItem element) {
+ elementsDiffRevision.add( element );
+ }
+
+ public Iterator getElementsOnlyInMaster() {
+ return elementsOnlyInMaster.iterator();
+ }
+
+ public Iterator getElementsOnlyInTranslation() {
+ return elementsOnlyInTranslation.iterator();
+ }
+ public Iterator getElementsDiffRevision() {
+ return elementsDiffRevision.iterator();
+ }
+}
Added: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/DiffCreator.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/DiffCreator.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/DiffCreator.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,100 @@
+package org.jboss.maven.docbook.revdiff;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+
+import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+import org.apache.maven.plugin.logging.Log;
+
+/**
+ * Responsible for creating a diff description.
+ *
+ * @author Steve Ebersole
+ */
+public class DiffCreator {
+
+ private final XMLReader parser;
+ private final Log log;
+
+ public DiffCreator(boolean xincludeSupport, Log log) throws GenerationException {
+ this.parser = generateParser( xincludeSupport );
+ this.log = log;
+ }
+
+ public synchronized Diff findDiff(File master, File translation) throws GenerationException {
+ Map catalog = new HashMap();
+
+ // Parse master file
+ BaselineHandler baselineHandler = new BaselineHandler( catalog );
+ parser.setContentHandler( baselineHandler );
+ try {
+ parser.parse( master.getAbsolutePath() );
+ }
+ catch( IOException e ) {
+ throw new GenerationException( "unable to locate specified master [" + master.getAbsolutePath() + "]", e );
+ }
+ catch ( SAXException e ) {
+ throw new GenerationException( "error parsing master [" + master.getAbsolutePath() + "]", e );
+ }
+
+ log.debug( "encountered [" + catalog.size() + "] master content elements" );
+
+ Diff diff = new Diff();
+
+ // Parse translation
+ TranslationHandler translationHandler = new TranslationHandler( catalog, diff );
+ parser.setContentHandler( translationHandler );
+ try {
+ parser.parse( translation.getAbsolutePath() );
+ }
+ catch ( IOException e ) {
+ throw new GenerationException( "unable to locate specified translation [" + translation.getAbsolutePath() + "]", e );
+ }
+ catch ( SAXException e ) {
+ throw new GenerationException( "error parsing translation [" + translation.getAbsolutePath() + "]", e );
+ }
+
+ // as a final step, allow translation handler to finish up
+ translationHandler.finish();
+
+ return diff;
+ }
+
+ private XMLReader generateParser(boolean xincludeSupport) throws GenerationException {
+ try {
+ XMLReader parser = createParserFactory( xincludeSupport ).newSAXParser().getXMLReader();
+// SAXParser parser = new SAXParser();
+ // Disable validation against DTD
+ parser.setFeature( "http://xml.org/sax/features/validation", false );
+ // Disable DTD loading in Xerces
+ parser.setFeature( "http://apache.org/xml/features/nonvalidating/load-external-dtd", false );
+ return parser;
+ }
+ catch ( SAXNotSupportedException e ) {
+ throw new GenerationException( "unable to generate SAX Parser", e );
+ }
+ catch ( SAXNotRecognizedException e ) {
+ throw new GenerationException( "unable to generate SAX Parser", e );
+ }
+ catch ( ParserConfigurationException e ) {
+ throw new GenerationException( "unable to generate SAX Parser", e );
+ }
+ catch ( SAXException e ) {
+ throw new GenerationException( "unable to generate SAX Parser", e );
+ }
+ }
+
+ private SAXParserFactory createParserFactory(boolean xincludeSupport) {
+ SAXParserFactory factory = new SAXParserFactoryImpl();
+ factory.setXIncludeAware( xincludeSupport );
+ return factory;
+ }
+}
Added: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/GenerationException.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/GenerationException.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/GenerationException.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,16 @@
+package org.jboss.maven.docbook.revdiff;
+
+/**
+ * Indicates problems generating the diff report
+ *
+ * @author Steve Ebersole
+ */
+public class GenerationException extends Exception {
+ public GenerationException(String message) {
+ super( message );
+ }
+
+ public GenerationException(String message, Throwable cause) {
+ super( message, cause );
+ }
+}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElement.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElement.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElement.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -1,53 +0,0 @@
-package org.jboss.maven.docbook.revdiff;
-
-/**
- * {@inheritDoc}
- *
- * @author Christian Bauer
- */
-public class ModuleElement {
-
- private String identifier;
- private ModuleElementState orgState;
- private ModuleElementState copyState;
-
- public ModuleElement(String identifier) {
- this.identifier = identifier;
- }
-
- public String getIdentifier() {
- return identifier;
- }
-
- public ModuleElementState getOrgState() {
- return orgState;
- }
-
- public void setOrgState(ModuleElementState orgState) {
- this.orgState = orgState;
- }
-
- public ModuleElementState getCopyState() {
- return copyState;
- }
-
- public void setCopyState(ModuleElementState copyState) {
- this.copyState = copyState;
- }
-
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof ModuleElement)) return false;
-
- final ModuleElement moduleElement = (ModuleElement) o;
-
- if (!identifier.equals(moduleElement.identifier)) return false;
-
- return true;
- }
-
- public int hashCode() {
- return identifier.hashCode();
- }
-
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementState.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementState.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementState.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -1,48 +0,0 @@
-package org.jboss.maven.docbook.revdiff;
-
-/**
- * {@inheritDoc}
- *
- * @author Christian Bauer
- */
-public class ModuleElementState {
- public static int REVISION_IGNORE = -1;
-
- private int revision;
- private String elementName;
- private String fileURL;
- private int row;
-
- public int getRevision() {
- return revision;
- }
-
- public void setRevision(int revision) {
- this.revision = revision;
- }
-
- public String getElementName() {
- return elementName;
- }
-
- public void setElementName(String elementName) {
- this.elementName = elementName;
- }
-
- public String getFileURL() {
- return fileURL;
- }
-
- public void setFileURL(String fileURL) {
- this.fileURL = fileURL;
- }
-
- public int getRow() {
- return row;
- }
-
- public void setRow(int row) {
- this.row = row;
- }
-
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementsComparator.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementsComparator.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementsComparator.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -1,77 +0,0 @@
-package org.jboss.maven.docbook.revdiff;
-
-import java.util.Iterator;
-import java.util.Set;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * {@inheritDoc}
- *
- * @author Christian Bauer
- */
-public class ModuleElementsComparator extends DefaultHandler {
-
- private Locator docLocator;
- private Set moduleElements;
-
- public ModuleElementsComparator(Set moduleElements) {
- this.moduleElements = moduleElements;
- }
-
- public void setDocumentLocator(Locator locator) {
- this.docLocator = locator;
- }
-
- public void startElement(
- String namespaceURI,
- String localName,
- String qualifiedName,
- Attributes atts) throws SAXException {
-
- // Only add ModuleElements that have an identifier
- String identifier = atts.getValue( "id" );
- if ( identifier != null ) {
- // The default revision for a ModuleElement is 0
- int revision = 0;
- if ( atts.getValue( "revision" ) != null ) {
- revision = new Integer( atts.getValue( "revision" ) ).intValue();
- }
-
- // Create new ModuleElement
- ModuleElement meNew = new ModuleElement( identifier );
-
- // Get original ModuleElement, if it exists (ugly...)
- ModuleElement meOld = null;
- for ( Iterator it = moduleElements.iterator(); it.hasNext(); ) {
- ModuleElement o = ( ModuleElement ) it.next();
- if ( o.equals( meNew ) ) {
- meOld = o;
- }
- }
-
- // Set state of new ModuleELement
- ModuleElementState newState = new ModuleElementState();
- newState.setRevision( revision );
- newState.setElementName( localName );
- newState.setFileURL( docLocator.getSystemId() );
- newState.setRow( docLocator.getLineNumber() );
-
- // Check if already present
- if ( meOld != null ) {
- // Present in both, set state of the copy on the original
- meOld.setCopyState( newState );
- }
- else {
- // ModuleElement exists only in the copy, set state and save
- meNew.setCopyState( newState );
- moduleElements.add( meNew );
- }
- }
-
- }
-
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementsExtractor.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementsExtractor.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementsExtractor.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -1,55 +0,0 @@
-package org.jboss.maven.docbook.revdiff;
-
-import java.util.Set;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * {@inheritDoc}
- *
- * @author Christian Bauer
- */
-public class ModuleElementsExtractor extends DefaultHandler {
-
- private Locator docLocator;
- private Set moduleElements;
-
- public ModuleElementsExtractor(Set moduleElements) {
- this.moduleElements = moduleElements;
- }
-
- public void setDocumentLocator(Locator locator) {
- this.docLocator = locator;
- }
-
- public void startElement(
- String namespaceURI,
- String localName,
- String qualifiedName,
- Attributes atts) throws SAXException {
-
- // Only add ModuleElements that have an identifier
- String identifier = atts.getValue( "id" );
- if ( identifier != null ) {
- // The default revision for a ModuleElement is 0
- int revision = 0;
- if ( atts.getValue( "revision" ) != null ) {
- revision = new Integer( atts.getValue( "revision" ) ).intValue();
- }
-
- // Generate new ModuleElement and new original state
- ModuleElement me = new ModuleElement( identifier );
- ModuleElementState meState = new ModuleElementState();
- meState.setRevision( revision );
- meState.setElementName( localName );
- meState.setFileURL( docLocator.getSystemId() );
- meState.setRow( docLocator.getLineNumber() );
- me.setOrgState( meState );
- moduleElements.add( me );
- }
- }
-
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleReport.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleReport.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleReport.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -1,13 +0,0 @@
-package org.jboss.maven.docbook.revdiff;
-
-import java.util.Set;
-import java.util.Properties;
-
-/**
- * {@inheritDoc}
- *
- * @author Christian Bauer
- */
-public interface ModuleReport {
- public void runReport(Set moduleElements, Properties properties);
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleReportHTML.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleReportHTML.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleReportHTML.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -1,159 +0,0 @@
-package org.jboss.maven.docbook.revdiff;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Set;
-
-/**
- * {@inheritDoc}
- *
- * @author Christian Bauer
- */
-public class ModuleReportHTML implements ModuleReport {
-
- public static final String DESTINATION_FILE = "DESTINATION_FILE";
-
- public void runReport(Set moduleElements, Properties properties) {
- if ( moduleElements == null ) {
- throw new NullPointerException( "Can't run a report on a null set of module elements." );
- }
- if ( !properties.containsKey( DESTINATION_FILE ) ) {
- throw new IllegalArgumentException( "Property not set: " + DESTINATION_FILE );
- }
-
- File file = new File( properties.getProperty( DESTINATION_FILE ) );
- try {
- FileWriter writer = new FileWriter( file );
- writer.write( pageHead() );
-
- if ( moduleElements.size() == 0 ) {
- writer.write( "<div align=center>No IDs found in either version.</div>" );
- writer.close();
- return;
- }
-
- writer.write( "<table cellpadding=4>" );
-
- writer.write( generateNewInOriginal( moduleElements ) );
- writer.write( "<tr><td> </td></tr>" );
- writer.write( generateDiffRevision( moduleElements ) );
- writer.write( "<tr><td> </td></tr>" );
- writer.write( generateNewInCopy( moduleElements ) );
-
- writer.write( "</table>" );
- writer.write( pageFoot() );
- writer.close();
- }
- catch ( IOException e ) {
- e.printStackTrace();
- }
- }
-
- private String pageHead() {
- StringBuffer buf = new StringBuffer( 256 );
- buf.append( "<html><head><title>Rowan Report:</title></head><body><div align=\"center\">" );
- buf.append( "<h3>Revision Diff Report</h3>" );
- return buf.toString();
- }
-
- private String pageFoot() {
- StringBuffer buf = new StringBuffer( 256 );
- buf.append( "</div></body></html>" );
- return buf.toString();
- }
-
- private String generateNewInOriginal(Set moduleElements) {
- StringBuffer buf = new StringBuffer();
- for ( Iterator it = moduleElements.iterator(); it.hasNext(); ) {
- ModuleElement me = ( ModuleElement ) it.next();
- if ( me.getOrgState() != null && me.getCopyState() == null ) {
- buf.append( "<tr><td bgcolor=#eeeeee>ID: " + me.getIdentifier() + "</td></tr>" );
- buf.append( "<tr><td>" );
- buf.append(
- "<b>" + me.getOrgState().getFileURL() +
- " (" + me.getOrgState().getRow() + ", " + me.getOrgState().getElementName() + ")</b>"
- );
- buf.append( "</td></tr>" );
- }
- }
-
- String result = "";
- if ( buf.length() > 0 ) {
- result = "<tr bgcolor=#cccccc><td><b>New in original:</b></td></tr>";
- }
- return result + buf.toString();
- }
-
- private String generateDiffRevision(Set moduleElements) {
- StringBuffer buf = new StringBuffer();
- for ( Iterator it = moduleElements.iterator(); it.hasNext(); ) {
- ModuleElement me = ( ModuleElement ) it.next();
- // If both states are present, but their revision is different (and shouldn't
- // be ignored) OR if the referenced element is also different...
- if ( me.getOrgState() != null && me.getCopyState() != null &&
- ( ( me.getOrgState().getRevision() != me.getCopyState().getRevision() ) ||
- !me.getOrgState().getElementName().equals( me.getCopyState().getElementName() ) ) &&
- me.getCopyState().getRevision() != ModuleElementState.REVISION_IGNORE ) {
- buf.append( "<tr><td bgcolor=#eeeeee>ID: " + me.getIdentifier() + "</td></tr>" );
- if ( !me.getOrgState().getElementName().equals( me.getCopyState().getElementName() ) ) {
- buf.append( "<tr><td bgcolor=#ee6666>" );
- buf.append(
- "Element names differ: " + me.getOrgState().getElementName() +
- "/" + me.getCopyState().getElementName()
- );
- buf.append( "</td></tr>" );
- }
- buf.append( "<tr><td>" );
- buf.append(
- "Original: <b>" + me.getOrgState().getFileURL() +
- " (" + me.getOrgState().getRow() + ", " + me.getOrgState().getElementName() + ")</b>"
- );
- buf.append( "</td></tr>" );
- buf.append( "<tr><td>" );
- buf.append(
- "Copy: <b>" + me.getCopyState().getFileURL() +
- " (" + me.getCopyState().getRow() + ", " + me.getCopyState().getElementName() + ")</b>"
- );
- buf.append( "</td></tr>" );
- buf.append( "<tr><td>" );
- buf.append( "Original Revision: " + me.getOrgState().getRevision() );
- buf.append( "</td></tr>" );
- buf.append( "<tr><td>" );
- buf.append( "Copy Revision: " + me.getCopyState().getRevision() );
- buf.append( "</td></tr>" );
- }
- }
- String result = "";
- if ( buf.length() > 0 ) {
- result = "<tr bgcolor=#cccccc><td><b>Copy needs update:</b></td></tr>";
- }
- return result + buf.toString();
- }
-
- private String generateNewInCopy(Set moduleElements) {
- StringBuffer buf = new StringBuffer();
- for ( Iterator it = moduleElements.iterator(); it.hasNext(); ) {
- ModuleElement me = ( ModuleElement ) it.next();
- if ( me.getCopyState() != null && me.getOrgState() == null &&
- me.getCopyState().getRevision() != ModuleElementState.REVISION_IGNORE ) {
- buf.append( "<tr><td bgcolor=#eeeeee>ID: " + me.getIdentifier() + "</td></tr>" );
- buf.append( "<tr><td>" );
- buf.append(
- "<b>" + me.getCopyState().getFileURL() +
- " (" + me.getCopyState().getRow() + ", " + me.getCopyState().getElementName() + ")</b>"
- );
- buf.append( "</td></tr>" );
- }
- }
- String result = "";
- if ( buf.length() > 0 ) {
- result = "<tr bgcolor=#cccccc><td><b>Only present in copy:</b></td></tr>";
- }
- return result + buf.toString();
- }
-
-}
-
Added: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ReportGenerator.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ReportGenerator.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ReportGenerator.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,187 @@
+package org.jboss.maven.docbook.revdiff;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.ResourceBundle;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.FileUtils;
+
+/**
+ * Generate a diff report.
+ *
+ * @author Christian Bauer
+ * @author Steve Ebersole
+ */
+public class ReportGenerator {
+ // todo : use templating...
+ private final String base;
+ private final ResourceBundle bundle;
+ private final Log log;
+
+ public ReportGenerator(File basedir, ResourceBundle bundle, Log log) {
+ try {
+ this.base = basedir.toURL().toExternalForm();
+ }
+ catch ( MalformedURLException e ) {
+ throw new IllegalArgumentException( "basedir was a malformed url" );
+ }
+ log.debug( "constructing docbook diff report generator [base=" + base + "]" );
+ this.bundle = bundle;
+ this.log = log;
+ }
+
+ public void generate(Diff diff, File output, String translation) throws GenerationException {
+ if ( output.exists() ) {
+ log.debug( "cleaning up previous translation-diff report output [" + output.getAbsolutePath() + "]" );
+ output.delete();
+ }
+
+ File outputDirectory = output.getParentFile();
+ if ( !outputDirectory.exists() ) {
+ String outputDirectoryPath = outputDirectory.getAbsolutePath();
+ log.debug( "creating translation-diff report directory [" + outputDirectoryPath + "]" );
+ FileUtils.mkdir( outputDirectoryPath );
+ }
+
+ try {
+ output.createNewFile();
+ }
+ catch ( IOException e ) {
+ throw new GenerationException( "unable to create output file [" + output.getAbsolutePath() + "]", e );
+ }
+
+ try {
+ FileWriter writer = new FileWriter( output );
+ writer.write( pageHead( translation ) );
+
+ writer.write( "<table cellpadding=4>" );
+
+ writer.write( generateNewInMaster( diff ) );
+ writer.write( "<tr><td> </td></tr>" );
+ writer.write( generateDiffRevision( diff ) );
+ writer.write( "<tr><td> </td></tr>" );
+ writer.write( generateNewInTranslation( diff ) );
+
+ writer.write( "</table>" );
+ writer.write( pageFoot() );
+ writer.close();
+ }
+ catch ( IOException e ) {
+ throw new GenerationException( "error writing report [" + output.getAbsolutePath() + "]", e );
+ }
+ }
+
+ private String pageHead(String translation) {
+ StringBuffer buf = new StringBuffer( 256 );
+ buf.append( "<html><head><title>" ).append( bundle.getString( "report.name" ) ).append( "</title></head><body><div align=\"center\">" );
+ buf.append( "<h3>" ).append( bundle.getString( "report.header") ).append( " - " ).append( translation ).append( "</h3>" );
+ return buf.toString();
+ }
+
+ private String pageFoot() {
+ StringBuffer buf = new StringBuffer( 256 );
+ buf.append( "</div></body></html>" );
+ return buf.toString();
+ }
+
+ private String generateNewInMaster(Diff diff) {
+ StringBuffer buf = new StringBuffer();
+ Iterator itr = diff.getElementsOnlyInMaster();
+ while ( itr.hasNext() ) {
+ final ContentItem contentItem = ( ContentItem ) itr.next();
+ buf.append( "<tr><td bgcolor=#eeeeee>ID: " ).append( contentItem.getIdentifier() ).append( "</td></tr>" );
+ buf.append( "<tr><td>" );
+ buf.append( "<b>" ).append( formatReference( contentItem.getMasterDescriptor() ) ).append( "</b>" );
+ buf.append( "</td></tr>" );
+ }
+
+ String result = "";
+ if ( buf.length() > 0 ) {
+ result = "<tr bgcolor=#cccccc><td><b>New in master:</b></td></tr>";
+ }
+ return result + buf.toString();
+ }
+
+ private String generateDiffRevision(Diff diff) {
+ StringBuffer buf = new StringBuffer();
+ Iterator itr = diff.getElementsDiffRevision();
+ while ( itr.hasNext() ) {
+ final ContentItem contentItem = ( ContentItem ) itr.next();
+ buf.append( "<tr><td bgcolor=#eeeeee>ID: " ).append( contentItem.getIdentifier() ).append( "</td></tr>" );
+ if ( !contentItem.getMasterDescriptor().getElementName().equals( contentItem.getTranslationDescriptor().getElementName() ) ) {
+ buf.append( "<tr><td bgcolor=#ee6666>" );
+ buf.append( "Element names differ: " )
+ .append( contentItem.getMasterDescriptor().getElementName() )
+ .append( "/" )
+ .append( contentItem.getTranslationDescriptor().getElementName() );
+ buf.append( "</td></tr>" );
+ }
+ buf.append( "<tr><td>" );
+ buf.append( "Master: <b>" ).append( formatReference( contentItem.getMasterDescriptor() ) ).append( "</b>" );
+ buf.append( "</td></tr>" );
+ buf.append( "<tr><td>" );
+ buf.append( "Translation: <b>" ).append( formatReference( contentItem.getTranslationDescriptor() ) ).append( "</b>" );
+ buf.append( "</td></tr>" );
+ buf.append( "<tr><td>" );
+ buf.append( "Master Revision: " ).append( contentItem.getMasterDescriptor().getRevision() );
+ buf.append( "</td></tr>" );
+ buf.append( "<tr><td>" );
+ buf.append( "Translation Revision: " ).append( contentItem.getTranslationDescriptor().getRevision() );
+ buf.append( "</td></tr>" );
+ }
+
+ String result = "";
+ if ( buf.length() > 0 ) {
+ result = "<tr bgcolor=#cccccc><td><b>Translation needs update:</b></td></tr>";
+ }
+ return result + buf.toString();
+ }
+
+ private String generateNewInTranslation(Diff diff) {
+ StringBuffer buf = new StringBuffer();
+ Iterator itr = diff.getElementsOnlyInTranslation();
+ while ( itr.hasNext() ) {
+ final ContentItem contentItem = ( ContentItem ) itr.next();
+ buf.append( "<tr><td bgcolor=#eeeeee>ID: " ).append( contentItem.getIdentifier() ).append( "</td></tr>" );
+ buf.append( "<tr><td>" );
+ buf.append( "<b>" ).append( formatReference( contentItem.getTranslationDescriptor() ) ).append( "</b>" );
+ buf.append( "</td></tr>" );
+ }
+ String result = "";
+ if ( buf.length() > 0 ) {
+ result = "<tr bgcolor=#cccccc><td><b>Only present in translation:</b></td></tr>";
+ }
+ return result + buf.toString();
+ }
+
+ private String formatReference(ContentItemDescriptor descriptor) {
+ return makeSystemIdRelative( descriptor.getSourceSystemId() ) +
+ ":" + descriptor.getElementName() +
+ " (" + descriptor.getRow() + "," + descriptor.getColumn() + ")";
+ }
+
+ private String makeSystemIdRelative(String systemId) {
+ String systemIdUrl = toURL( systemId ).toExternalForm();
+ log.debug( "checking source [" + systemIdUrl + "] against base [" + base + "]" );
+ if ( systemIdUrl.startsWith( base ) ) {
+ return systemIdUrl.substring( base.length() );
+ }
+ else {
+ return systemIdUrl;
+ }
+ }
+
+ private URL toURL(String systemId) {
+ try {
+ return new URL( systemId );
+ }
+ catch ( MalformedURLException e ) {
+ throw new UnsupportedOperationException( "unable to parse systemId [" + systemId + "] as URL" );
+ }
+ }
+}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/RevisionDiffMojo.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/RevisionDiffMojo.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/RevisionDiffMojo.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -1,101 +0,0 @@
-package org.jboss.maven.docbook.revdiff;
-
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Properties;
-import java.io.IOException;
-
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.xerces.parsers.SAXParser;
-import org.xml.sax.XMLReader;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.jboss.maven.docbook.revdiff.ModuleElementsExtractor;
-import org.jboss.maven.docbook.revdiff.ModuleElementsComparator;
-import org.jboss.maven.docbook.revdiff.ModuleReportHTML;
-import org.jboss.maven.docbook.revdiff.ModuleReport;
-
-/**
- * A plugin for generating a "revision diff" report across different
- * translations of the same document. This is useful for the translators to
- * know what changes exist between their translation and another.
- *
- * @goal revision-diff
- *
- * @author Christian Bauer
- * @author Steve Ebersole
- */
-public class RevisionDiffMojo extends AbstractMojo {
- /**
- * The translation against which to baseline the diff.
- *
- * @parameter
- * @required
- */
- private String original;
-
- /**
- * The translation to be compared to the master.
- *
- * @parameter
- * @required
- */
- private String copy;
-
- /**
- * The file where the diff report should be written.
- *
- * @parameter default="${build.outputDirectory}/docbkx/revdiff
- * @required
- */
- private String reportFile;
-
- public void execute() throws MojoExecutionException, MojoFailureException {
- Set moduleElements = new HashSet();
- XMLReader parser = generateParser();
- try {
- // Parse original file
- parser.setContentHandler( new ModuleElementsExtractor( moduleElements ) );
- parser.parse( original );
-
- // Parse copy
- parser.setContentHandler( new ModuleElementsComparator( moduleElements ) );
- parser.parse( copy );
-
- // Set properties for HTML report
- Properties props = new Properties();
- props.setProperty( ModuleReportHTML.DESTINATION_FILE, reportFile );
-
- // Generate HTML report
- ModuleReport report = new ModuleReportHTML();
- report.runReport( moduleElements, props );
- }
- catch ( IOException e ) {
- throw new MojoExecutionException( "Files not found : " + original + " or " + copy, e );
-
- }
- catch ( Exception e ) {
- throw new MojoExecutionException( "unable to run revdiff report", e );
- }
-
- }
-
- private XMLReader generateParser() throws MojoExecutionException {
- try {
- SAXParser parser = new SAXParser();
- // Disable validation against DTD
- parser.setFeature( "http://xml.org/sax/features/validation", false );
- // Disable DTD loading in Xerces
- parser.setFeature( "http://apache.org/xml/features/nonvalidating/load-external-dtd", false );
- return parser;
- }
- catch ( SAXNotSupportedException e ) {
- throw new MojoExecutionException( "unable to generate SAX Parser", e );
- }
- catch ( SAXNotRecognizedException e ) {
- throw new MojoExecutionException( "unable to generate SAX Parser", e );
- }
- }
-}
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationDiffReport.java (from rev 11460, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/RevisionDiffMojo.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationDiffReport.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationDiffReport.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,284 @@
+package org.jboss.maven.docbook.revdiff;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import org.apache.maven.doxia.siterenderer.Renderer;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.reporting.AbstractMavenReport;
+import org.apache.maven.reporting.MavenReportException;
+import org.codehaus.plexus.util.DirectoryScanner;
+
+/**
+ * A plugin for generating a "translation diff" report across different
+ * translations of the same document. This is useful for the translators to
+ * know what changes exist between their translation and the master.
+ *
+ * @goal diff
+ *
+ * @author Christian Bauer
+ * @author Steve Ebersole
+ */
+public class TranslationDiffReport extends AbstractMavenReport {
+
+ public static final String NAME = "translation-diff-report";
+
+ /**
+ * The directory containing the translated DocBook sources.
+ *
+ * @parameter expression="${basedir}/src/main/docbook/translations"
+ * @required
+ */
+ private File translationsDirectory;
+
+ /**
+ * Directory where reports will go.
+ *
+ * @parameter expression="${project.reporting.outputDirectory}"
+ * @required
+ * @readonly
+ */
+ private File reportingDirectory;
+
+ /**
+ * Which translation is considered the master.
+ *
+ * @parameter default="en"
+ * @required
+ */
+ private String masterTranslation;
+
+ /**
+ * (non master) translations to be included in the report.
+ *
+ * @parameter
+ * @required
+ */
+ private String[] translations;
+
+ /**
+ * Patternsets of sources (relative to translationsDirectory) to include
+ * in reporting.
+ *
+ * @parameter default="*.xml"
+ * @required
+ */
+ private String[] sourceIncludes;
+
+ /**
+ * A boolean, indicating if XInclude should be supported.
+ *
+ * @parameter default="false"
+ */
+ private boolean xincludeSupported;
+
+ /**
+ * Whether to build an aggregated report at the root, or build individual reports.
+ *
+ * @parameter expression="${aggregate}" default-value="false"
+ */
+ protected boolean aggregate;
+
+ /**
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ private File reportOutputDirectory;
+
+ /**
+ * @parameter expression="${component.org.apache.maven.doxia.siterenderer.Renderer}"
+ * @required
+ * @readonly
+ */
+ private Renderer siteRenderer;
+
+ protected Renderer getSiteRenderer() {
+ return siteRenderer;
+ }
+
+ protected MavenProject getProject() {
+ return project;
+ }
+
+ public String getCategoryName() {
+ return CATEGORY_PROJECT_REPORTS;
+ }
+
+ protected String getOutputDirectory() {
+ return getReportOutputDirectory().getAbsolutePath();
+ }
+
+ public String getOutputName() {
+ return "index";
+ }
+
+ public String getName(Locale locale) {
+ return getBundle( locale ).getString( "report.name" );
+ }
+
+ public String getDescription(Locale locale) {
+ return getBundle( locale ).getString( "report.description" );
+ }
+
+ private ResourceBundle getBundle(Locale locale) {
+ return ResourceBundle.getBundle( NAME, locale, this.getClass().getClassLoader() );
+ }
+
+ public void setReportOutputDirectory(File dir) {
+ if ( NAME.equals( dir.getName() ) ) {
+ this.reportOutputDirectory = dir;
+ }
+ else {
+ this.reportOutputDirectory = new File( dir, NAME );
+ }
+ }
+
+ public File getReportOutputDirectory() {
+ if ( reportOutputDirectory == null ) {
+ reportOutputDirectory = new File( reportingDirectory, NAME );
+ }
+ return reportOutputDirectory;
+ }
+
+ public boolean isExternalReport() {
+ return false;
+ }
+
+ public boolean canGenerateReport() {
+ return translations != null && translations.length > 0
+ && sourceIncludes != null && sourceIncludes.length > 0;
+ }
+
+ protected void executeReport(Locale locale) throws MavenReportException {
+ getLog().debug( "starting docbook:diff goal execution [masterTranslation=" + masterTranslation + "]" );
+
+ if ( ! translationsDirectory.exists() ) {
+ getLog().debug( "translations directory [" + translationsDirectory.getAbsolutePath() + "] did not exist" );
+ return;
+ }
+
+ File masterTranslationDirectory = new File( translationsDirectory, masterTranslation );
+ if ( ! masterTranslationDirectory.exists() ) {
+ getLog().info( "master translation directory [" + masterTranslationDirectory.getAbsolutePath() + "] did not exist" );
+ return;
+ }
+
+ List reports = new ArrayList();
+ for ( int i = 0; i < translations.length; i++ ) {
+ if ( masterTranslation.equals( translations[i] ) ) {
+ continue;
+ }
+ final File translationDirectory = new File( translationsDirectory, translations[i] );
+ if ( ! translationDirectory.exists() ) {
+ getLog().info( "translation directory [" + translationDirectory.getAbsolutePath() + "] did not exist" );
+ continue;
+ }
+
+ File output = new File( getReportOutputDirectory(), "report-" + translations[i] + ".html" );
+ prepReportFile( output );
+
+ generateTranslationReport( masterTranslationDirectory, translationDirectory, output, new Locale( translations[i] ) );
+ reports.add( output.getName() );
+ }
+
+ writeReportIndex( reports );
+ }
+
+ private void prepReportFile(File reportFile) throws MavenReportException {
+ if ( reportFile.exists() ) {
+ reportFile.delete();
+ }
+ if ( !reportFile.exists() ) {
+ try {
+ reportFile.createNewFile();
+ }
+ catch ( IOException e ) {
+ throw new MavenReportException( "unable to prep report file [" + reportFile.getAbsolutePath() + "]" );
+ }
+ }
+ }
+
+ private void generateTranslationReport(
+ File masterTranslationDirectory,
+ File translationDirectory,
+ File output,
+ Locale locale) throws MavenReportException {
+ getLog().debug( "starting docbook:diff processing [translation=" + locale + "]" );
+
+ DirectoryScanner scanner = new DirectoryScanner();
+ scanner.setBasedir( masterTranslationDirectory );
+ scanner.setIncludes( sourceIncludes );
+ scanner.scan();
+ String[] masterSources = scanner.getIncludedFiles();
+
+ scanner = new DirectoryScanner();
+ scanner.setBasedir( translationDirectory );
+ scanner.setIncludes( sourceIncludes );
+ scanner.scan();
+ String[] translationSources = scanner.getIncludedFiles();
+
+ if ( ! Arrays.equals( masterSources, translationSources ) ) {
+ getLog().warn( "includes returned different master and translation sets" );
+ return;
+ }
+
+ try {
+ DiffCreator diffCreator = new DiffCreator( xincludeSupported, getLog() );
+ ReportGenerator generator = new ReportGenerator( translationsDirectory, getBundle( locale ), getLog() );
+
+ for ( int i = 0; i < masterSources.length; i++ ) {
+ getLog().debug( "processing source [" + masterSources[i] + "]" );
+ final File master = new File( masterTranslationDirectory, masterSources[i] );
+ final File translation = new File( translationDirectory, translationSources[i] );
+ final Diff diff = diffCreator.findDiff( master, translation );
+ generator.generate( diff, output, locale.toString() );
+ }
+ }
+ catch ( GenerationException e ) {
+ throw new MavenReportException( "unable to generate report", e );
+ }
+ }
+
+ private void writeReportIndex(List reports) throws MavenReportException {
+ getLog().debug( "writing index report via provided sink" );
+ getSink().head();
+ getSink().text( getBundle( Locale.ENGLISH ).getString( "report.name" ) );
+ getSink().head_();
+
+ getSink().body();
+ getSink().sectionTitle1();
+ getSink().anchor( getBundle( Locale.ENGLISH ).getString( "report.header" ) );
+ getSink().anchor_();
+ getSink().text( getBundle( Locale.ENGLISH ).getString( "report.header" ) );
+ getSink().sectionTitle1_();
+
+ getSink().table();
+ Iterator itr = reports.iterator();
+ while ( itr.hasNext() ) {
+ final String reportURL = ( String ) itr.next();
+ getSink().tableRow();
+ getSink().tableCell();
+ getSink().link( reportURL );
+ getSink().text( reportURL );
+ getSink().link_();
+ getSink().tableCell_();
+ getSink().tableRow_();
+ }
+ getSink().table_();
+
+ getSink().body_();
+ getSink().flush();
+ getSink().close();
+ getLog().debug( "index report sink flushed and closed" );
+ }
+
+}
Added: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationHandler.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationHandler.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationHandler.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,93 @@
+package org.jboss.maven.docbook.revdiff;
+
+import java.util.Map;
+import java.util.Iterator;
+import java.net.URL;
+import java.net.MalformedURLException;
+
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Handles actually discerning diffs between the translations based on the
+ * revision numbers of the content elements.
+ *
+ * @author Christian Bauer
+ * @author Steve Ebersole
+ */
+public class TranslationHandler extends DefaultHandler {
+ private final Map catalog;
+ private final Diff diff;
+ private Locator docLocator;
+
+ public TranslationHandler(Map catalog, Diff diff) {
+ this.catalog = catalog;
+ this.diff = diff;
+ }
+
+ public void setDocumentLocator(Locator locator) {
+ this.docLocator = locator;
+ }
+
+ public void startElement(
+ String namespaceURI,
+ String localName,
+ String qualifiedName,
+ Attributes atts) throws SAXException {
+
+ String identifier = atts.getValue( "id" );
+ if ( identifier != null ) {
+ int revision = 0;
+ if ( atts.getValue( "revision" ) != null ) {
+ revision = new Integer( atts.getValue( "revision" ) ).intValue();
+ }
+
+ ContentItemDescriptor translationState = new ContentItemDescriptor(
+ docLocator.getSystemId(),
+ qualifiedName,
+ revision,
+ docLocator.getLineNumber(),
+ docLocator.getColumnNumber()
+ );
+
+ // Locate the corresponding ContentItem from the master
+ //
+ // NOTE: we use remove to keep track of the fact that the transation
+ // has used that element; that way, afterwards, we know all the
+ // "unused" ones which would indicate elements recently added to
+ // the master...
+ ContentItem contentItem = ( ContentItem ) catalog.remove( identifier );
+ if ( contentItem == null ) {
+ // we have encountered an element in the translation which
+ // is not present in the master. This *should indicate that we
+ // have a section that was removed from the master, but not yet
+ // removed from the translation...
+ if ( revision != ContentItemDescriptor.REVISION_IGNORE ) {
+ contentItem = new ContentItem( identifier );
+ contentItem.setTranslationDescriptor( translationState );
+ diff.addOnlyInTranslation( contentItem );
+ }
+ }
+ else {
+ // the element is present in both; check the revisions
+ if ( revision != contentItem.getMasterDescriptor().getRevision() && revision != ContentItemDescriptor.REVISION_IGNORE ) {
+ contentItem.setTranslationDescriptor( translationState );
+ diff.addDiffRevision( contentItem );
+ }
+ }
+ }
+ }
+
+ public void finish() {
+ // anything left in the catalog at this point is stuff that is present
+ // in the master but absent from the translation...
+ Iterator itr = catalog.entrySet().iterator();
+ while ( itr.hasNext() ) {
+ final ContentItem contentItem = ( ContentItem ) ( ( Map.Entry ) itr.next() ).getValue();
+ itr.remove();
+ diff.addOnlyInMaster( contentItem );
+ }
+ }
+}
Added: trunk/sandbox/maven-poc/plugins/docbook/src/main/resources/META-INF/plexus/components.xml
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/resources/META-INF/plexus/components.xml (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/resources/META-INF/plexus/components.xml 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,10 @@
+<component-set>
+ <components>
+ <component>
+ <role>org.apache.maven.reporting.MavenReport</role>
+ <role-hint>diff</role-hint>
+ <implementation>org.jboss.maven.docbook.revdiff.TranslationDiffReport</implementation>
+ <instantiation-strategy>per-lookup</instantiation-strategy>
+ </component>
+ </components>
+</component-set>
\ No newline at end of file
Added: trunk/sandbox/maven-poc/plugins/docbook/src/main/resources/translation-diff-report.properties
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/resources/translation-diff-report.properties (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/resources/translation-diff-report.properties 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,3 @@
+report.name=Translation Diff Report
+report.description=Calculates differences between translation and master
+report.header=Translation Diff Report
Modified: trunk/sandbox/maven-poc/plugins/docbook/src/test/java/org/jboss/maven/docbook/gen/RendererTest.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/test/java/org/jboss/maven/docbook/gen/RendererTest.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/test/java/org/jboss/maven/docbook/gen/RendererTest.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -58,12 +58,19 @@
),
},
new Format[] {
+// new Format(
+// "pdf",
+// "fopdf.xsl",
+// false,
+// "pdf",
+// finalNameMap
+// ),
new Format(
- "pdf",
- "fopdf.xsl",
+ "html",
+ "html.xsl",
false,
- "pdf",
- finalNameMap
+ "html",
+ null
)
}
);
@@ -75,7 +82,7 @@
File translationsDirectory = sourceFile.getParentFile().getParentFile();
File baseDirectory = translationsDirectory.getParentFile();
File standardResources = new File( baseDirectory, "standard/resources" );
- File standardStyles = new File( baseDirectory, "standard/style" );
+ File standardStyles = new File( baseDirectory, "standard/xslt" );
File targetDirectory = baseDirectory.getParentFile()
.getParentFile()
@@ -91,7 +98,8 @@
System.out.println( "writing output to : " + targetDirectory.getAbsolutePath() );
Properties props = new Properties();
- props.setProperty( "book.titlepage.img", new File( translationsDirectory, "../standard/resources/shared/images/hibernate_logo_a.png" ).getAbsolutePath() );
+ props.setProperty( "custom.titlepage.img", new File( translationsDirectory, "../standard/resources/shared/images/hibernate_logo_a.png" ).getAbsolutePath() );
+// props.setProperty( "html.stylesheet", new File( translationsDirectory, "../standard/resources/shared/css/html.css" ).getAbsolutePath() );
Settings settings = new Settings(
translationsDirectory,
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt (from rev 11461, trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style)
Modified: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt/fopdf.xsl
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style/fopdf.xsl 2007-05-03 07:25:50 UTC (rev 11461)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt/fopdf.xsl 2007-05-04 04:41:23 UTC (rev 11464)
@@ -28,7 +28,7 @@
Custom Title Page
################################################### -->
- <xsl:param name="book.titlepage.img">1</xsl:param>
+ <xsl:param name="custom.titlepage.img">1</xsl:param>
<xsl:template name="book.titlepage.recto">
<fo:block>
<fo:table table-layout="fixed" width="175mm">
@@ -40,7 +40,7 @@
<fo:external-graphic content-height="1.2cm">
<xsl:attribute name="src">
<xsl:call-template name="fo-external-image">
- <xsl:with-param name="filename" select="$book.titlepage.img"/>
+ <xsl:with-param name="filename" select="$custom.titlepage.img"/>
</xsl:call-template>
</xsl:attribute>
</fo:external-graphic>
Modified: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt/html.xsl
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style/html.xsl 2007-05-03 07:25:50 UTC (rev 11461)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt/html.xsl 2007-05-04 04:41:23 UTC (rev 11464)
@@ -14,16 +14,13 @@
christian at hibernate.org
-->
-<!DOCTYPE xsl:stylesheet [
- <!ENTITY db_xsl_path "../../support/docbook-xsl/">
-]>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ exclude-result-prefixes="#default">
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version="1.0"
- xmlns="http://www.w3.org/TR/xhtml1/transitional"
- exclude-result-prefixes="#default">
-
-<xsl:import href="&db_xsl_path;/html/docbook.xsl"/>
+ <xsl:import href="urn:docbkx:stylesheet" />
<!--###################################################
HTML Settings
Modified: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt/html_chunk.xsl
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style/html_chunk.xsl 2007-05-03 07:25:50 UTC (rev 11461)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt/html_chunk.xsl 2007-05-04 04:41:23 UTC (rev 11464)
@@ -14,16 +14,13 @@
christian at hibernate.org
-->
-<!DOCTYPE xsl:stylesheet [
- <!ENTITY db_xsl_path "../../support/docbook-xsl/">
-]>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ exclude-result-prefixes="#default">
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version="1.0"
- xmlns="http://www.w3.org/TR/xhtml1/transitional"
- exclude-result-prefixes="#default">
-
-<xsl:import href="&db_xsl_path;/html/chunk.xsl"/>
+ <xsl:import href="urn:docbkx:stylesheet" />
<!--###################################################
HTML Settings
More information about the hibernate-commits
mailing list