From: fotis Date: Tue, 14 Mar 2000 09:43:09 +0000 (+0000) Subject: new fop examples and tests X-Git-Tag: pre-columns~565 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6851a8efe0544cb6d17f19a7d05a225400ccf0bb;p=xmlgraphics-fop.git new fop examples and tests git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193299 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/examples/build.xml b/docs/examples/build.xml new file mode 100644 index 000000000..85e3007a9 --- /dev/null +++ b/docs/examples/build.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/examples/list.fo b/docs/examples/list.fo deleted file mode 100644 index 90c673474..000000000 --- a/docs/examples/list.fo +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - XSL-FO Example: simple list - p. - - - - - - - - Validity Constraint: Standalone Document Declaration - - - - - The standalone document declaration must have the value "no" if - any external markup declarations contain declarations of: - - - - - - - - - - - - - - - attributes with default values, if elements to which these attributes apply appear in the document without specifications of values for these attributes, or - - - - - - - - - - - - - - entities (other than amp, lt, gt, apos, quot), if references to those entities appear in the document, or - - - - - - - - - - - - - - attributes with values subject to normalization, where the attribute appears in the document with a value which will - - - - - - - - - - - - - - change as a result of normalization, or - - - - - - - - - - - - - - element types with element content, if white space occurs directly within any instance of those types. - - - - - - - - - - - - diff --git a/docs/examples/list.pdf b/docs/examples/list.pdf deleted file mode 100644 index f5dbeb5f1..000000000 --- a/docs/examples/list.pdf +++ /dev/null @@ -1,282 +0,0 @@ -%PDF-1.2 -1 0 obj -<< /Type /Catalog -/Pages 2 0 R >> -endobj -2 0 obj -<< /Type /Pages -/Count 0 -/Kids [18 0 R ] >> -endobj -3 0 obj -<< /Type /Info -/Producer (FOP 0.12.1[dev]) >> -endobj -4 0 obj -<< /Font << /F11 5 0 R -/F10 6 0 R -/F9 7 0 R -/F8 8 0 R -/F7 9 0 R -/F6 10 0 R -/F5 11 0 R -/F4 12 0 R -/F3 13 0 R -/F2 14 0 R -/F1 15 0 R -/F12 16 0 R ->> -/ProcSet [ /PDF /ImageC /Text ] >> -endobj -5 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F11 -/BaseFont /Courier-Bold -/Encoding /WinAnsiEncoding >> -endobj -6 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F10 -/BaseFont /Courier-Oblique -/Encoding /WinAnsiEncoding >> -endobj -7 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F9 -/BaseFont /Courier -/Encoding /WinAnsiEncoding >> -endobj -8 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F8 -/BaseFont /Times-BoldItalic -/Encoding /WinAnsiEncoding >> -endobj -9 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F7 -/BaseFont /Times-Bold -/Encoding /WinAnsiEncoding >> -endobj -10 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F6 -/BaseFont /Times-Italic -/Encoding /WinAnsiEncoding >> -endobj -11 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F5 -/BaseFont /Times-Roman -/Encoding /WinAnsiEncoding >> -endobj -12 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F4 -/BaseFont /Helvetica-BoldOblique -/Encoding /WinAnsiEncoding >> -endobj -13 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F3 -/BaseFont /Helvetica-Bold -/Encoding /WinAnsiEncoding >> -endobj -14 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F2 -/BaseFont /Helvetica-Oblique -/Encoding /WinAnsiEncoding >> -endobj -15 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F1 -/BaseFont /Helvetica -/Encoding /WinAnsiEncoding >> -endobj -16 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F12 -/BaseFont /Courier-BoldOblique -/Encoding /WinAnsiEncoding >> -endobj -17 0 obj -<< /Length 4557 >> -stream -BT -1 0 0 1 70.875 678.6 Tm -/F3 14 Tf -1 0 0 1 85.875 663.548 Tm (Validity) Tj -1 0 0 1 139.565 663.548 Tm (Constraint:) Tj -1 0 0 1 218.119 663.548 Tm (Standalone) Tj -1 0 0 1 297.471 663.548 Tm (Document) Tj -1 0 0 1 369.809 663.548 Tm (Declaration) Tj -/F1 12 Tf -1 0 0 1 70.875 645.534 Tm (The) Tj -1 0 0 1 94.887 645.534 Tm (standalone) Tj -1 0 0 1 156.927 645.534 Tm (document) Tj -1 0 0 1 212.955 645.534 Tm (declaration) Tj -1 0 0 1 274.983 645.534 Tm (must) Tj -1 0 0 1 304.323 645.534 Tm (have) Tj -1 0 0 1 333.675 645.534 Tm (the) Tj -1 0 0 1 353.691 645.534 Tm (value) Tj -1 0 0 1 385.707 645.534 Tm ("no") Tj -1 0 0 1 410.907 645.534 Tm (if) Tj -1 0 0 1 420.243 645.534 Tm (any) Tj -1 0 0 1 442.923 645.534 Tm (external) Tj -1 0 0 1 70.875 631.434 Tm (markup) Tj -1 0 0 1 114.219 631.434 Tm (declarations) Tj -1 0 0 1 182.247 631.434 Tm (contain) Tj -1 0 0 1 224.271 631.434 Tm (declarations) Tj -1 0 0 1 292.299 631.434 Tm (of:) Tj -1 0 0 1 70.875 614.634 Tm (\225) Tj -1 0 0 1 94.875 614.634 Tm (attributes) Tj -1 0 0 1 147.567 614.634 Tm (with) Tj -1 0 0 1 172.239 614.634 Tm (default) Tj -1 0 0 1 211.599 614.634 Tm (values,) Tj -1 0 0 1 252.951 614.634 Tm (if) Tj -1 0 0 1 262.287 614.634 Tm (elements) Tj -1 0 0 1 314.307 614.634 Tm (to) Tj -1 0 0 1 327.651 614.634 Tm (which) Tj -1 0 0 1 361.659 614.634 Tm (these) Tj -1 0 0 1 394.347 614.634 Tm (attributes) Tj -1 0 0 1 447.039 614.634 Tm (apply) Tj -1 0 0 1 94.875 601.134 Tm (appear) Tj -1 0 0 1 135.567 601.134 Tm (in) Tj -1 0 0 1 148.239 601.134 Tm (the) Tj -1 0 0 1 168.255 601.134 Tm (document) Tj -1 0 0 1 224.283 601.134 Tm (without) Tj -1 0 0 1 265.635 601.134 Tm (specifications) Tj -1 0 0 1 340.995 601.134 Tm (of) Tj -1 0 0 1 354.339 601.134 Tm (values) Tj -1 0 0 1 392.355 601.134 Tm (for) Tj -1 0 0 1 409.695 601.134 Tm (these) Tj -1 0 0 1 442.383 601.134 Tm (attributes,) Tj -1 0 0 1 94.875 587.634 Tm (or) Tj -1 0 0 1 70.875 574.134 Tm (\225) Tj -1 0 0 1 94.875 574.134 Tm (entities) Tj -1 0 0 1 136.227 574.134 Tm (\(other) Tj -1 0 0 1 170.907 574.134 Tm (than) Tj -1 0 0 1 197.595 574.134 Tm (amp,) Tj -1 0 0 1 227.607 574.134 Tm (lt,) Tj -1 0 0 1 240.279 574.134 Tm (gt,) Tj -1 0 0 1 256.959 574.134 Tm (apos,) Tj -1 0 0 1 289.647 574.134 Tm (quot\),) Tj -1 0 0 1 323.667 574.134 Tm (if) Tj -1 0 0 1 333.003 574.134 Tm (references) Tj -1 0 0 1 393.027 574.134 Tm (to) Tj -1 0 0 1 406.371 574.134 Tm (those) Tj -1 0 0 1 439.059 574.134 Tm (entities) Tj -1 0 0 1 94.875 560.634 Tm (appear) Tj -1 0 0 1 135.567 560.634 Tm (in) Tj -1 0 0 1 148.239 560.634 Tm (the) Tj -1 0 0 1 168.255 560.634 Tm (document,) Tj -1 0 0 1 227.619 560.634 Tm (or) Tj -1 0 0 1 70.875 547.134 Tm (\225) Tj -1 0 0 1 94.875 547.134 Tm (attributes) Tj -1 0 0 1 147.567 547.134 Tm (with) Tj -1 0 0 1 172.239 547.134 Tm (values) Tj -1 0 0 1 210.255 547.134 Tm (subject) Tj -1 0 0 1 251.607 547.134 Tm (to) Tj -1 0 0 1 264.951 547.134 Tm (normalization,) Tj -1 0 0 1 342.975 547.134 Tm (where) Tj -1 0 0 1 378.987 547.134 Tm (the) Tj -1 0 0 1 399.003 547.134 Tm (attribute) Tj -1 0 0 1 445.695 547.134 Tm (appears) Tj -1 0 0 1 492.387 547.134 Tm (in) Tj -1 0 0 1 94.875 533.634 Tm (the) Tj -1 0 0 1 114.891 533.634 Tm (document) Tj -1 0 0 1 170.919 533.634 Tm (with) Tj -1 0 0 1 195.591 533.634 Tm (a) Tj -1 0 0 1 205.599 533.634 Tm (value) Tj -1 0 0 1 237.615 533.634 Tm (which) Tj -1 0 0 1 271.623 533.634 Tm (will) Tj -1 0 0 1 70.875 520.134 Tm (\225) Tj -1 0 0 1 94.875 520.134 Tm (change) Tj -1 0 0 1 137.571 520.134 Tm (as) Tj -1 0 0 1 153.579 520.134 Tm (a) Tj -1 0 0 1 163.587 520.134 Tm (result) Tj -1 0 0 1 196.263 520.134 Tm (of) Tj -1 0 0 1 209.607 520.134 Tm (normalization,) Tj -1 0 0 1 287.631 520.134 Tm (or) Tj -1 0 0 1 70.875 506.634 Tm (\225) Tj -1 0 0 1 94.875 506.634 Tm (element) Tj -1 0 0 1 140.895 506.634 Tm (types) Tj -1 0 0 1 172.911 506.634 Tm (with) Tj -1 0 0 1 197.583 506.634 Tm (element) Tj -1 0 0 1 243.603 506.634 Tm (content,) Tj -1 0 0 1 289.635 506.634 Tm (if) Tj -1 0 0 1 298.971 506.634 Tm (white) Tj -1 0 0 1 330.315 506.634 Tm (space) Tj -1 0 0 1 365.667 506.634 Tm (occurs) Tj -1 0 0 1 404.343 506.634 Tm (directly) Tj -1 0 0 1 445.683 506.634 Tm (within) Tj -1 0 0 1 479.691 506.634 Tm (any) Tj -1 0 0 1 94.875 493.134 Tm (instance) Tj -1 0 0 1 142.899 493.134 Tm (of) Tj -1 0 0 1 156.243 493.134 Tm (those) Tj -1 0 0 1 188.931 493.134 Tm (types.) Tj -1 0 0 1 70.875 763.65 Tm -/F5 10 Tf -1 0 0 1 359.565 754.82 Tm (XSL-FO) Tj -1 0 0 1 397.065 754.82 Tm (Example:) Tj -1 0 0 1 437.895 754.82 Tm (simple) Tj -1 0 0 1 467.065 754.82 Tm (list) Tj -1 0 0 1 481.795 754.82 Tm (-) Tj -1 0 0 1 487.625 754.82 Tm (p.) Tj -1 0 0 1 497.625 754.82 Tm (1) Tj -1 0 0 1 70.875 99.225 Tm -ET - -endstream -endobj -18 0 obj -<< /Type /Page -/Parent 2 0 R -/MediaBox [ 0 0 576 792 ] -/Resources 4 0 R -/Contents 17 0 R ->> -endobj -xref -0 19 -0000000000 65535 f -0000000009 00000 n -0000000058 00000 n -0000000117 00000 n -0000000178 00000 n -0000000373 00000 n -0000000484 00000 n -0000000598 00000 n -0000000703 00000 n -0000000817 00000 n -0000000925 00000 n -0000001036 00000 n -0000001146 00000 n -0000001266 00000 n -0000001379 00000 n -0000001495 00000 n -0000001603 00000 n -0000001722 00000 n -0000006331 00000 n -trailer -<< -/Size 19 -/Root 1 0 R -/Info 3 0 R ->> -startxref -6439 -%%EOF diff --git a/docs/examples/normal.fo b/docs/examples/normal.fo deleted file mode 100644 index a15753784..000000000 --- a/docs/examples/normal.fo +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - XML Recommendation - p. - - - - - - - - Extensible Markup Language (XML) 1.0 - - - - - Abstract - - - - - The Extensible Markup Language (XML) is a subset of SGML that is completely described in this document. Its goal is to - enable generic SGML to be served, received, and processed on the Web in the way that is now possible with HTML. XML - has been designed for ease of implementation and for interoperability with both SGML and HTML. - - - - - Status of this document - - - - - This document has been reviewed by W3C Members and other interested parties and has been endorsed by the Director as a - W3C Recommendation. It is a stable document and may be used as reference material or cited as a normative reference from - another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its - widespread deployment. This enhances the functionality and interoperability of the Web. - - - - - This document specifies a syntax created by subsetting an existing, widely used international text processing standard - (Standard Generalized Markup Language, ISO 8879:1986(E) as amended and corrected) for use on the World Wide Web. It - is a product of the W3C XML Activity, details of which can be found at http://www.w3.org/XML. A list of current W3C - Recommendations and other technical documents can be found at http://www.w3.org/TR. - - - - diff --git a/docs/examples/normal.pdf b/docs/examples/normal.pdf deleted file mode 100644 index ea48e1da6..000000000 --- a/docs/examples/normal.pdf +++ /dev/null @@ -1,386 +0,0 @@ -%PDF-1.2 -1 0 obj -<< /Type /Catalog -/Pages 2 0 R >> -endobj -2 0 obj -<< /Type /Pages -/Count 0 -/Kids [18 0 R ] >> -endobj -3 0 obj -<< /Type /Info -/Producer (FOP 0.12.1[dev]) >> -endobj -4 0 obj -<< /Font << /F11 5 0 R -/F10 6 0 R -/F9 7 0 R -/F8 8 0 R -/F7 9 0 R -/F6 10 0 R -/F5 11 0 R -/F4 12 0 R -/F3 13 0 R -/F2 14 0 R -/F1 15 0 R -/F12 16 0 R ->> -/ProcSet [ /PDF /ImageC /Text ] >> -endobj -5 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F11 -/BaseFont /Courier-Bold -/Encoding /WinAnsiEncoding >> -endobj -6 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F10 -/BaseFont /Courier-Oblique -/Encoding /WinAnsiEncoding >> -endobj -7 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F9 -/BaseFont /Courier -/Encoding /WinAnsiEncoding >> -endobj -8 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F8 -/BaseFont /Times-BoldItalic -/Encoding /WinAnsiEncoding >> -endobj -9 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F7 -/BaseFont /Times-Bold -/Encoding /WinAnsiEncoding >> -endobj -10 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F6 -/BaseFont /Times-Italic -/Encoding /WinAnsiEncoding >> -endobj -11 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F5 -/BaseFont /Times-Roman -/Encoding /WinAnsiEncoding >> -endobj -12 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F4 -/BaseFont /Helvetica-BoldOblique -/Encoding /WinAnsiEncoding >> -endobj -13 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F3 -/BaseFont /Helvetica-Bold -/Encoding /WinAnsiEncoding >> -endobj -14 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F2 -/BaseFont /Helvetica-Oblique -/Encoding /WinAnsiEncoding >> -endobj -15 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F1 -/BaseFont /Helvetica -/Encoding /WinAnsiEncoding >> -endobj -16 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F12 -/BaseFont /Courier-BoldOblique -/Encoding /WinAnsiEncoding >> -endobj -17 0 obj -<< /Length 8284 >> -stream -BT -1 0 0 1 70.875 678.6 Tm -0.0 0.0 1.0 rg -0.0 0.0 1.0 RG -70.875 681.6 434.25 -25.65 re S -70.875 681.6 434.25 -25.65 re f -0 0 0 RG 0 0 0 rg -/F1 18 Tf -1.0 1.0 1.0 rg -1 0 0 1 126.927 662.676 Tm (Extensible) Tj -1 0 0 1 214.965 662.676 Tm (Markup) Tj -1 0 0 1 279.981 662.676 Tm (Language) Tj -1 0 0 1 365.049 662.676 Tm (\(XML\)) Tj -1 0 0 1 419.049 662.676 Tm (1.0) Tj -/F1 16 Tf -0.0 0.0 0.0 rg -1 0 0 1 70.875 617.462 Tm (Abstract) Tj -/F1 12 Tf -1 0 0 1 70.875 592.034 Tm (The) Tj -1 0 0 1 94.887 592.034 Tm (Extensible) Tj -1 0 0 1 153.579 592.034 Tm (Markup) Tj -1 0 0 1 196.923 592.034 Tm (Language) Tj -1 0 0 1 253.635 592.034 Tm (\(XML\)) Tj -1 0 0 1 289.635 592.034 Tm (is) Tj -1 0 0 1 301.635 592.034 Tm (a) Tj -1 0 0 1 311.643 592.034 Tm (subset) Tj -1 0 0 1 350.331 592.034 Tm (of) Tj -1 0 0 1 363.675 592.034 Tm (SGML) Tj -1 0 0 1 401.019 592.034 Tm (that) Tj -1 0 0 1 424.371 592.034 Tm (is) Tj -1 0 0 1 436.371 592.034 Tm (completely) Tj -1 0 0 1 70.875 577.934 Tm (described) Tj -1 0 0 1 126.231 577.934 Tm (in) Tj -1 0 0 1 138.903 577.934 Tm (this) Tj -1 0 0 1 160.911 577.934 Tm (document.) Tj -1 0 0 1 220.275 577.934 Tm (Its) Tj -1 0 0 1 236.283 577.934 Tm (goal) Tj -1 0 0 1 262.299 577.934 Tm (is) Tj -1 0 0 1 274.299 577.934 Tm (to) Tj -1 0 0 1 287.643 577.934 Tm (enable) Tj -1 0 0 1 327.003 577.934 Tm (generic) Tj -1 0 0 1 369.687 577.934 Tm (SGML) Tj -1 0 0 1 407.031 577.934 Tm (to) Tj -1 0 0 1 420.375 577.934 Tm (be) Tj -1 0 0 1 437.055 577.934 Tm (served,) Tj -1 0 0 1 70.875 563.834 Tm (received,) Tj -1 0 0 1 122.895 563.834 Tm (and) Tj -1 0 0 1 146.247 563.834 Tm (processed) Tj -1 0 0 1 204.939 563.834 Tm (on) Tj -1 0 0 1 221.619 563.834 Tm (the) Tj -1 0 0 1 241.635 563.834 Tm (Web) Tj -1 0 0 1 269.643 563.834 Tm (in) Tj -1 0 0 1 282.315 563.834 Tm (the) Tj -1 0 0 1 302.331 563.834 Tm (way) Tj -1 0 0 1 327.003 563.834 Tm (that) Tj -1 0 0 1 350.355 563.834 Tm (is) Tj -1 0 0 1 362.355 563.834 Tm (now) Tj -1 0 0 1 387.699 563.834 Tm (possible) Tj -1 0 0 1 435.051 563.834 Tm (with) Tj -1 0 0 1 459.723 563.834 Tm (HTML.) Tj -1 0 0 1 70.875 549.734 Tm (XML) Tj -1 0 0 1 98.883 549.734 Tm (has) Tj -1 0 0 1 121.563 549.734 Tm (been) Tj -1 0 0 1 151.587 549.734 Tm (designed) Tj -1 0 0 1 203.619 549.734 Tm (for) Tj -1 0 0 1 220.959 549.734 Tm (ease) Tj -1 0 0 1 250.311 549.734 Tm (of) Tj -1 0 0 1 263.655 549.734 Tm (implementation) Tj -1 0 0 1 348.351 549.734 Tm (and) Tj -1 0 0 1 371.703 549.734 Tm (for) Tj -1 0 0 1 389.043 549.734 Tm (interoperability) Tj -1 0 0 1 470.403 549.734 Tm (with) Tj -1 0 0 1 70.875 535.634 Tm (both) Tj -1 0 0 1 97.563 535.634 Tm (SGML) Tj -1 0 0 1 134.907 535.634 Tm (and) Tj -1 0 0 1 158.259 535.634 Tm (HTML.) Tj -/F1 16 Tf -1 0 0 1 70.875 505.162 Tm (Status) Tj -1 0 0 1 120.683 505.162 Tm (of) Tj -1 0 0 1 138.475 505.162 Tm (this) Tj -1 0 0 1 167.819 505.162 Tm (document) Tj -/F1 12 Tf -1 0 0 1 70.875 479.734 Tm (This) Tj -1 0 0 1 96.879 479.734 Tm (document) Tj -1 0 0 1 152.907 479.734 Tm (has) Tj -1 0 0 1 175.587 479.734 Tm (been) Tj -1 0 0 1 205.611 479.734 Tm (reviewed) Tj -1 0 0 1 256.959 479.734 Tm (by) Tj -1 0 0 1 272.967 479.734 Tm (W3C) Tj -1 0 0 1 302.967 479.734 Tm (Members) Tj -1 0 0 1 356.307 479.734 Tm (and) Tj -1 0 0 1 379.659 479.734 Tm (other) Tj -1 0 0 1 410.343 479.734 Tm (interested) Tj -1 0 0 1 466.371 479.734 Tm (parties) Tj -1 0 0 1 70.875 465.634 Tm (and) Tj -1 0 0 1 94.227 465.634 Tm (has) Tj -1 0 0 1 116.907 465.634 Tm (been) Tj -1 0 0 1 146.931 465.634 Tm (endorsed) Tj -1 0 0 1 200.295 465.634 Tm (by) Tj -1 0 0 1 216.303 465.634 Tm (the) Tj -1 0 0 1 236.319 465.634 Tm (Director) Tj -1 0 0 1 281.655 465.634 Tm (as) Tj -1 0 0 1 297.663 465.634 Tm (a) Tj -1 0 0 1 307.671 465.634 Tm (W3C) Tj -1 0 0 1 337.671 465.634 Tm (Recommendation.) Tj -1 0 0 1 438.375 465.634 Tm (It) Tj -1 0 0 1 448.383 465.634 Tm (is) Tj -1 0 0 1 460.383 465.634 Tm (a) Tj -1 0 0 1 470.391 465.634 Tm (stable) Tj -1 0 0 1 70.875 451.534 Tm (document) Tj -1 0 0 1 126.903 451.534 Tm (and) Tj -1 0 0 1 150.255 451.534 Tm (may) Tj -1 0 0 1 176.259 451.534 Tm (be) Tj -1 0 0 1 192.939 451.534 Tm (used) Tj -1 0 0 1 222.291 451.534 Tm (as) Tj -1 0 0 1 238.299 451.534 Tm (reference) Tj -1 0 0 1 292.323 451.534 Tm (material) Tj -1 0 0 1 338.331 451.534 Tm (or) Tj -1 0 0 1 352.335 451.534 Tm (cited) Tj -1 0 0 1 381.015 451.534 Tm (as) Tj -1 0 0 1 397.023 451.534 Tm (a) Tj -1 0 0 1 407.031 451.534 Tm (normative) Tj -1 0 0 1 70.875 437.434 Tm (reference) Tj -1 0 0 1 124.899 437.434 Tm (from) Tj -1 0 0 1 152.235 437.434 Tm (another) Tj -1 0 0 1 196.263 437.434 Tm (document.) Tj -1 0 0 1 255.627 437.434 Tm (W3C's) Tj -1 0 0 1 293.919 437.434 Tm (role) Tj -1 0 0 1 317.259 437.434 Tm (in) Tj -1 0 0 1 329.931 437.434 Tm (making) Tj -1 0 0 1 371.943 437.434 Tm (the) Tj -1 0 0 1 391.959 437.434 Tm (Recommendation) Tj -1 0 0 1 489.327 437.434 Tm (is) Tj -1 0 0 1 70.875 423.334 Tm (to) Tj -1 0 0 1 84.219 423.334 Tm (draw) Tj -1 0 0 1 113.559 423.334 Tm (attention) Tj -1 0 0 1 162.927 423.334 Tm (to) Tj -1 0 0 1 176.271 423.334 Tm (the) Tj -1 0 0 1 196.287 423.334 Tm (specification) Tj -1 0 0 1 265.647 423.334 Tm (and) Tj -1 0 0 1 288.999 423.334 Tm (to) Tj -1 0 0 1 302.343 423.334 Tm (promote) Tj -1 0 0 1 349.695 423.334 Tm (its) Tj -1 0 0 1 365.031 423.334 Tm (widespread) Tj -1 0 0 1 429.723 423.334 Tm (deployment.) Tj -1 0 0 1 70.875 409.234 Tm (This) Tj -1 0 0 1 96.879 409.234 Tm (enhances) Tj -1 0 0 1 152.247 409.234 Tm (the) Tj -1 0 0 1 172.263 409.234 Tm (functionality) Tj -1 0 0 1 238.959 409.234 Tm (and) Tj -1 0 0 1 262.311 409.234 Tm (interoperability) Tj -1 0 0 1 343.671 409.234 Tm (of) Tj -1 0 0 1 357.015 409.234 Tm (the) Tj -1 0 0 1 377.031 409.234 Tm (Web.) Tj -1 0 0 1 70.875 392.134 Tm (This) Tj -1 0 0 1 96.879 392.134 Tm (document) Tj -1 0 0 1 152.907 392.134 Tm (specifies) Tj -1 0 0 1 202.923 392.134 Tm (a) Tj -1 0 0 1 212.931 392.134 Tm (syntax) Tj -1 0 0 1 250.947 392.134 Tm (created) Tj -1 0 0 1 294.303 392.134 Tm (by) Tj -1 0 0 1 310.311 392.134 Tm (subsetting) Tj -1 0 0 1 368.343 392.134 Tm (an) Tj -1 0 0 1 385.023 392.134 Tm (existing,) Tj -1 0 0 1 432.375 392.134 Tm (widely) Tj -1 0 0 1 469.047 392.134 Tm (used) Tj -1 0 0 1 70.875 378.034 Tm (international) Tj -1 0 0 1 139.575 378.034 Tm (text) Tj -1 0 0 1 162.255 378.034 Tm (processing) Tj -1 0 0 1 223.611 378.034 Tm (standard) Tj -1 0 0 1 273.639 378.034 Tm (\(Standard) Tj -1 0 0 1 329.667 378.034 Tm (Generalized) Tj -1 0 0 1 397.695 378.034 Tm (Markup) Tj -1 0 0 1 441.039 378.034 Tm (Language,) Tj -1 0 0 1 70.875 363.934 Tm (ISO) Tj -1 0 0 1 94.887 363.934 Tm (8879:1986\(E\)) Tj -1 0 0 1 170.931 363.934 Tm (as) Tj -1 0 0 1 186.939 363.934 Tm (amended) Tj -1 0 0 1 240.303 363.934 Tm (and) Tj -1 0 0 1 263.655 363.934 Tm (corrected\)) Tj -1 0 0 1 321.003 363.934 Tm (for) Tj -1 0 0 1 338.343 363.934 Tm (use) Tj -1 0 0 1 361.023 363.934 Tm (on) Tj -1 0 0 1 377.703 363.934 Tm (the) Tj -1 0 0 1 397.719 363.934 Tm (World) Tj -1 0 0 1 432.387 363.934 Tm (Wide) Tj -1 0 0 1 463.059 363.934 Tm (Web.) Tj -1 0 0 1 494.403 363.934 Tm (It) Tj -1 0 0 1 70.875 349.834 Tm (is) Tj -1 0 0 1 82.875 349.834 Tm (a) Tj -1 0 0 1 92.883 349.834 Tm (product) Tj -1 0 0 1 136.239 349.834 Tm (of) Tj -1 0 0 1 149.583 349.834 Tm (the) Tj -1 0 0 1 169.599 349.834 Tm (W3C) Tj -1 0 0 1 199.599 349.834 Tm (XML) Tj -1 0 0 1 227.607 349.834 Tm (Activity,) Tj -1 0 0 1 272.283 349.834 Tm (details) Tj -1 0 0 1 310.299 349.834 Tm (of) Tj -1 0 0 1 323.643 349.834 Tm (which) Tj -1 0 0 1 357.651 349.834 Tm (can) Tj -1 0 0 1 380.331 349.834 Tm (be) Tj -1 0 0 1 397.011 349.834 Tm (found) Tj -1 0 0 1 430.371 349.834 Tm (at) Tj -1 0 0 1 70.875 335.734 Tm (http://www.w3.org/XML.) Tj -1 0 0 1 200.919 335.734 Tm (A) Tj -1 0 0 1 212.259 335.734 Tm (list) Tj -1 0 0 1 230.259 335.734 Tm (of) Tj -1 0 0 1 243.603 335.734 Tm (current) Tj -1 0 0 1 284.283 335.734 Tm (W3C) Tj -1 0 0 1 314.283 335.734 Tm (Recommendations) Tj -1 0 0 1 417.651 335.734 Tm (and) Tj -1 0 0 1 441.003 335.734 Tm (other) Tj -1 0 0 1 70.875 321.634 Tm (technical) Tj -1 0 0 1 121.563 321.634 Tm (documents) Tj -1 0 0 1 183.591 321.634 Tm (can) Tj -1 0 0 1 206.271 321.634 Tm (be) Tj -1 0 0 1 222.951 321.634 Tm (found) Tj -1 0 0 1 256.311 321.634 Tm (at) Tj -1 0 0 1 269.655 321.634 Tm (http://www.w3.org/TR.) Tj -1 0 0 1 70.875 763.65 Tm -/F5 10 Tf -1 0 0 1 384.025 754.82 Tm (XML) Tj -1 0 0 1 408.745 754.82 Tm (Recommendation) Tj -1 0 0 1 481.795 754.82 Tm (-) Tj -1 0 0 1 487.625 754.82 Tm (p.) Tj -1 0 0 1 497.625 754.82 Tm (1) Tj -1 0 0 1 70.875 99.225 Tm -ET - -endstream -endobj -18 0 obj -<< /Type /Page -/Parent 2 0 R -/MediaBox [ 0 0 576 792 ] -/Resources 4 0 R -/Contents 17 0 R ->> -endobj -xref -0 19 -0000000000 65535 f -0000000009 00000 n -0000000058 00000 n -0000000117 00000 n -0000000178 00000 n -0000000373 00000 n -0000000484 00000 n -0000000598 00000 n -0000000703 00000 n -0000000817 00000 n -0000000925 00000 n -0000001036 00000 n -0000001146 00000 n -0000001266 00000 n -0000001379 00000 n -0000001495 00000 n -0000001603 00000 n -0000001722 00000 n -0000010058 00000 n -trailer -<< -/Size 19 -/Root 1 0 R -/Info 3 0 R ->> -startxref -10166 -%%EOF diff --git a/docs/examples/results.html b/docs/examples/results.html new file mode 100644 index 000000000..3b9e87266 --- /dev/null +++ b/docs/examples/results.html @@ -0,0 +1,12 @@ +Test Results + +

Compare Results
+created 14.03.2000 10:36:22

+ + + + + + + +
reference filetest fileidentical?
normal.pdf normal.pdf Yes
table.pdf table.pdf Yes
list.pdf list.pdf Yes
link.pdf link.pdf Yes
border.pdf border.pdf Yes
extensive.pdf extensive.pdf No
diff --git a/docs/examples/runtests.bat b/docs/examples/runtests.bat new file mode 100755 index 000000000..87047a6fd --- /dev/null +++ b/docs/examples/runtests.bat @@ -0,0 +1,26 @@ +@echo off + +echo Fop Test +echo ---------------- + +if "%JAVA_HOME%" == "" goto error + +set LOCALCLASSPATH=%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\classes.zip;..\..\lib\ant.jar;..\..\lib\xml.jar;..\..\lib +set ANT_HOME=.\lib + +echo Starting Tests ... + +%JAVA_HOME%\bin\java.exe -Dant.home=%ANT_HOME% -classpath %LOCALCLASSPATH%;%CLASSPATH% org.apache.tools.ant.Main %1 %2 %3 %4 %5 + +goto end + +:error + +echo ERROR: JAVA_HOME not found in your environment. +echo Please, set the JAVA_HOME variable in your environment to match the +echo location of the Java Virtual Machine you want to use. + +:end + +rem set LOCALCLASSPATH= + diff --git a/docs/examples/table.fo b/docs/examples/table.fo deleted file mode 100644 index 5c8f46823..000000000 --- a/docs/examples/table.fo +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - FOP - p. - - - - - - - Content - - - - - - - - - - A) - - - What is FOP? - - - - - B) - - - Downloading FOP - - - - - C) - - - Running FOP - - - - - D) - - - Embedding FOP - - - - - E) - - - What's Implemented? - - - - - F) - - - Limitations - - - - - G) - - - Bugs - - - - - H) - - - Compiling FOP - - - - - I) - - - Getting involved - - - - - J) - - - FOP Relevant Specifications - - - - - K) - - - Licence - - - - - - - diff --git a/docs/examples/table.pdf b/docs/examples/table.pdf deleted file mode 100644 index 4182580c9..000000000 --- a/docs/examples/table.pdf +++ /dev/null @@ -1,203 +0,0 @@ -%PDF-1.2 -1 0 obj -<< /Type /Catalog -/Pages 2 0 R >> -endobj -2 0 obj -<< /Type /Pages -/Count 0 -/Kids [18 0 R ] >> -endobj -3 0 obj -<< /Type /Info -/Producer (FOP 0.12.1[dev]) >> -endobj -4 0 obj -<< /Font << /F11 5 0 R -/F10 6 0 R -/F9 7 0 R -/F8 8 0 R -/F7 9 0 R -/F6 10 0 R -/F5 11 0 R -/F4 12 0 R -/F3 13 0 R -/F2 14 0 R -/F1 15 0 R -/F12 16 0 R ->> -/ProcSet [ /PDF /ImageC /Text ] >> -endobj -5 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F11 -/BaseFont /Courier-Bold -/Encoding /WinAnsiEncoding >> -endobj -6 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F10 -/BaseFont /Courier-Oblique -/Encoding /WinAnsiEncoding >> -endobj -7 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F9 -/BaseFont /Courier -/Encoding /WinAnsiEncoding >> -endobj -8 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F8 -/BaseFont /Times-BoldItalic -/Encoding /WinAnsiEncoding >> -endobj -9 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F7 -/BaseFont /Times-Bold -/Encoding /WinAnsiEncoding >> -endobj -10 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F6 -/BaseFont /Times-Italic -/Encoding /WinAnsiEncoding >> -endobj -11 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F5 -/BaseFont /Times-Roman -/Encoding /WinAnsiEncoding >> -endobj -12 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F4 -/BaseFont /Helvetica-BoldOblique -/Encoding /WinAnsiEncoding >> -endobj -13 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F3 -/BaseFont /Helvetica-Bold -/Encoding /WinAnsiEncoding >> -endobj -14 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F2 -/BaseFont /Helvetica-Oblique -/Encoding /WinAnsiEncoding >> -endobj -15 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F1 -/BaseFont /Helvetica -/Encoding /WinAnsiEncoding >> -endobj -16 0 obj -<< /Type /Font -/Subtype /Type1 -/Name /F12 -/BaseFont /Courier-BoldOblique -/Encoding /WinAnsiEncoding >> -endobj -17 0 obj -<< /Length 1457 >> -stream -BT -1 0 0 1 70.875 678.6 Tm -/F3 10 Tf -1 0 0 1 85.875 671.42 Tm (Content) Tj -/F1 10 Tf -1 0 0 1 86.445 658.17 Tm (A\)) Tj -1 0 0 1 99.225 658.17 Tm (What) Tj -1 0 0 1 125.345 658.17 Tm (is) Tj -1 0 0 1 135.345 658.17 Tm (FOP?) Tj -1 0 0 1 86.445 646.92 Tm (B\)) Tj -1 0 0 1 99.225 646.92 Tm (Downloading) Tj -1 0 0 1 159.805 646.92 Tm (FOP) Tj -1 0 0 1 85.895 635.67 Tm (C\)) Tj -1 0 0 1 99.225 635.67 Tm (Running) Tj -1 0 0 1 139.245 635.67 Tm (FOP) Tj -1 0 0 1 85.895 624.42 Tm (D\)) Tj -1 0 0 1 99.225 624.42 Tm (Embedding) Tj -1 0 0 1 152.585 624.42 Tm (FOP) Tj -1 0 0 1 86.445 613.17 Tm (E\)) Tj -1 0 0 1 99.225 613.17 Tm (What's) Tj -1 0 0 1 132.255 613.17 Tm (Implemented?) Tj -1 0 0 1 87.005 601.92 Tm (F\)) Tj -1 0 0 1 99.225 601.92 Tm (Limitations) Tj -1 0 0 1 85.335 590.67 Tm (G\)) Tj -1 0 0 1 99.225 590.67 Tm (Bugs) Tj -1 0 0 1 85.895 579.42 Tm (H\)) Tj -1 0 0 1 99.225 579.42 Tm (Compiling) Tj -1 0 0 1 146.455 579.42 Tm (FOP) Tj -1 0 0 1 90.335 568.17 Tm (I\)) Tj -1 0 0 1 99.225 568.17 Tm (Getting) Tj -1 0 0 1 134.245 568.17 Tm (involved) Tj -1 0 0 1 88.115 556.92 Tm (J\)) Tj -1 0 0 1 99.225 556.92 Tm (FOP) Tj -1 0 0 1 122.565 556.92 Tm (Relevant) Tj -1 0 0 1 164.805 556.92 Tm (Specifications) Tj -1 0 0 1 86.445 545.67 Tm (K\)) Tj -1 0 0 1 99.225 545.67 Tm (Licence) Tj -1 0 0 1 70.875 763.65 Tm -/F5 10 Tf -1 0 0 1 460.955 754.82 Tm (FOP) Tj -1 0 0 1 481.795 754.82 Tm (-) Tj -1 0 0 1 487.625 754.82 Tm (p.) Tj -1 0 0 1 497.625 754.82 Tm (1) Tj -1 0 0 1 70.875 99.225 Tm -ET - -endstream -endobj -18 0 obj -<< /Type /Page -/Parent 2 0 R -/MediaBox [ 0 0 576 792 ] -/Resources 4 0 R -/Contents 17 0 R ->> -endobj -xref -0 19 -0000000000 65535 f -0000000009 00000 n -0000000058 00000 n -0000000117 00000 n -0000000178 00000 n -0000000373 00000 n -0000000484 00000 n -0000000598 00000 n -0000000703 00000 n -0000000817 00000 n -0000000925 00000 n -0000001036 00000 n -0000001146 00000 n -0000001266 00000 n -0000001379 00000 n -0000001495 00000 n -0000001603 00000 n -0000001722 00000 n -0000003231 00000 n -trailer -<< -/Size 19 -/Root 1 0 R -/Info 3 0 R ->> -startxref -3339 -%%EOF diff --git a/lib/Compare.class b/lib/Compare.class new file mode 100644 index 000000000..714ffface Binary files /dev/null and b/lib/Compare.class differ diff --git a/lib/Compare.java b/lib/Compare.java new file mode 100644 index 000000000..66e02005d --- /dev/null +++ b/lib/Compare.java @@ -0,0 +1,146 @@ +/* +// header - edit "Data/yourJavaHeader" to customize +// contents - edit "EventHandlers/Java file/onCreate" to customize +// +*/ + +import java.util.*; +import java.io.*; +import org.apache.tools.ant.Task; +import org.apache.tools.ant.BuildException; +import java.text.DateFormat; + + +public class Compare { + private String referenceDirectory, testDirectory; + private String [] filenameList; + private String filenames; + private static boolean IDENTICAL_FILES = true; + private static boolean NOTIDENTICAL_FILES = false; + private BufferedInputStream oldfileInput; + private BufferedInputStream newfileInput; + + //sets directory for test files + public void setTestDirectory(String testDirectory) { + if (!(testDirectory.endsWith("/") | testDirectory.endsWith("\\"))) { + testDirectory += File.separator; + } + this.testDirectory = testDirectory; + } + + //sets directory for reference files + public void setReferenceDirectory(String referenceDirectory) { + if (!(referenceDirectory.endsWith("/") | referenceDirectory.endsWith("\\"))) { + referenceDirectory += File.separator; + } + this.referenceDirectory = referenceDirectory; + } + + public void setFilenames (String filenames) { + StringTokenizer tokens = new StringTokenizer(filenames,","); + Vector filenameListTmp = new Vector(20); + while (tokens.hasMoreTokens()) { + filenameListTmp.add(tokens.nextToken()); + } + filenameList = new String [filenameListTmp.size()] ; + filenameListTmp.copyInto((String[]) filenameList); + } + + private boolean compareBytes (File oldFile, File newFile) { + try { + oldfileInput = new BufferedInputStream(new FileInputStream(oldFile)); + newfileInput = new BufferedInputStream(new FileInputStream(newFile)); + int charactO = 0; + int charactN = 0; + boolean identical = true; + + while (identical & (charactO != -1)) { + if (charactO == charactN) { + charactO = oldfileInput.read(); + charactN = newfileInput.read(); + } else { + return NOTIDENTICAL_FILES; + } + } + return IDENTICAL_FILES; + } catch (IOException io) { + System.err.println("Task Compare - Error: \n" + io.toString()); + } + return NOTIDENTICAL_FILES; + } + + private boolean compareFileSize(File oldFile, File newFile) { + if (oldFile.length() != newFile.length()) { + return NOTIDENTICAL_FILES; + } else { + return IDENTICAL_FILES; + } + } //end: compareBytes + + private boolean filesExist (File oldFile, File newFile) { + if (!oldFile.exists()) { + System.err.println("Task Compare - ERROR: File " + + referenceDirectory + oldFile.getName() + + " doesn't exist!"); + return false; + } else if (!newFile.exists()) { + System.err.println("Task Compare - ERROR: File " + + testDirectory + newFile.getName() + " doesn't exist!"); + return false; + } else { + return true; + } + } + + public void writeHeader (PrintWriter results) { + String dateTime = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM).format(new Date()); + results.println("Test Results\n"); + results.println("

Compare Results
"); + results.println("created " + dateTime + "

"); + results.println("" + + ""); + + + } + + //main method of task compare + public void execute () throws BuildException { + boolean identical = false; + File oldFile; + File newFile; + try { + PrintWriter results = new PrintWriter (new FileWriter("results.html"),true); + this.writeHeader(results); + for (int i = 0; i < filenameList.length; i++) { + oldFile = new File (referenceDirectory + filenameList[i]); + newFile = new File (testDirectory + filenameList[i]); + if (filesExist(oldFile, newFile)) { + identical = compareFileSize(oldFile, newFile); + if (identical) { + identical = compareBytes(oldFile,newFile); + } + if (!identical) { + System.out.println("Task Compare: \nFiles " + referenceDirectory + + oldFile.getName()+ " - " + testDirectory + + newFile.getName() + " are *not* identical."); + results.println(""); + } else { + results.println(""); + } + } + } + results.println("
reference filetest fileidentical?
" + + oldFile.getName() + " " + + newFile.getName() +"" + + " No
" + + oldFile.getName() + " " + + newFile.getName() + "" + + " Yes
"); + } catch (IOException ioe) { + System.err.println("ERROR: " + ioe); + } + } //end: execute() +} + diff --git a/lib/Fop.class b/lib/Fop.class new file mode 100644 index 000000000..b4c595116 Binary files /dev/null and b/lib/Fop.class differ diff --git a/lib/Fop.java b/lib/Fop.java new file mode 100644 index 000000000..aa342945c --- /dev/null +++ b/lib/Fop.java @@ -0,0 +1,122 @@ +// Ant +import org.apache.tools.ant.Task; +import org.apache.tools.ant.BuildException; +import org.apache.fop.apps.*; + +// SAX +import org.xml.sax.Parser; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; + +// Java +import java.io.FileReader; +import java.io.File; +import java.io.FileWriter; +import java.io.PrintWriter; +import java.io.IOException; +import java.io.FileNotFoundException; +import java.net.URL; + +/* the code is adapted from Fops CommandLine class */ +public class Fop { + String fofile, pdffile; + + public void setFofile(String fofile) { + this.fofile = fofile; + } + + public void setPdffile(String pdffile) { + this.pdffile = pdffile; + } + + + /** + * creates a SAX parser, using the value of org.xml.sax.parser + * defaulting to org.apache.xerces.parsers.SAXParser + * + * @return the created SAX parser + */ + static Parser createParser() { + String parserClassName = System.getProperty("org.xml.sax.parser"); + if (parserClassName == null) { + parserClassName = "org.apache.xerces.parsers.SAXParser"; + } + System.err.println("using SAX parser " + parserClassName); + + try { + return (Parser) Class.forName(parserClassName).newInstance(); + } catch (ClassNotFoundException e) { + System.err.println("Could not find " + parserClassName); + } catch (InstantiationException e) { + System.err.println("Could not instantiate " + parserClassName); + } catch (IllegalAccessException e) { + System.err.println("Could not access " + parserClassName); + } catch (ClassCastException e) { + System.err.println(parserClassName + " is not a SAX driver"); + } + return null; + } + + /** + * create an InputSource from a file name + * + * @param filename the name of the file + * @return the InputSource created + */ + protected static InputSource fileInputSource(String filename) { + + /* this code adapted from James Clark's in XT */ + File file = new File(filename); + String path = file.getAbsolutePath(); + String fSep = System.getProperty("file.separator"); + if (fSep != null && fSep.length() == 1) + path = path.replace(fSep.charAt(0), '/'); + if (path.length() > 0 && path.charAt(0) != '/') + path = '/' + path; + try { + return new InputSource(new URL("file", null, + path).toString()); + } + catch (java.net.MalformedURLException e) { + throw new Error("unexpected MalformedURLException"); + } + } + + public void execute () throws BuildException { + boolean errors = false; + String version = Version.getVersion(); + System.out.println("=======================\nTask " + version + + "\nconverting file " + fofile + " to " + pdffile); + + if (!(new File(fofile).exists())) { + errors = true; + System.err.println("Task Fop - ERROR: Formatting objects file " + fofile + " missing."); + } + + Parser parser = createParser(); + + if (parser == null) { + System.err.println("Task Fop - ERROR: Unable to create SAX parser"); + errors = true; + } + + if (!errors) { + try { + Driver driver = new Driver(); + driver.setRenderer("org.apache.fop.render.pdf.PDFRenderer", version); + driver.addElementMapping("org.apache.fop.fo.StandardElementMapping"); + driver.addElementMapping("org.apache.fop.svg.SVGElementMapping"); + driver.setWriter(new PrintWriter(new FileWriter(pdffile))); + driver.buildFOTree(parser, fileInputSource(fofile)); + driver.format(); + driver.render(); + } catch (Exception e) { + System.err.println("Task Fop - FATAL ERROR: " + e.getMessage()); + System.exit(1); + } + } + System.out.println("=======================\n"); + } +} + diff --git a/lib/Xslt.class b/lib/Xslt.class index 2c24a38cd..63a56aa9f 100644 Binary files a/lib/Xslt.class and b/lib/Xslt.class differ diff --git a/lib/Xslt.java b/lib/Xslt.java index c24c1b132..b2daa1ee8 100644 --- a/lib/Xslt.java +++ b/lib/Xslt.java @@ -9,28 +9,28 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. * * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES @@ -51,12 +51,13 @@ * information on the Apache Software Foundation, please see * . */ - + //package org.apache.tools.ant.taskdefs; import org.apache.tools.ant.Task; import java.net.*; import java.io.*; +import java.util.*; import org.apache.xalan.xslt.*; /** @@ -70,142 +71,219 @@ import org.apache.xalan.xslt.*; *
  • xsltfile *
  • outfile *
  • smart + *
  • dependent * *

    * Of these arguments, infile, outfile and xsltfile are required. - * smart defaults to 'no'. The other allowed value is 'yes'. If smart is set to 'yes' + *

    smart defaults to 'no'. The other allowed value is 'yes'. If smart is set to 'yes' * xalan is only called if either the outfile is older than the infile or the stylesheet - * or the outfile doesn't exist. + * or the outfile doesn't exist. + *

    dependent defaults to 'none'. Other possible values: a comma delimited list of file names + * which date is checked against the output file. This way you can name files which, if + * they have been modified, initiate a restart of the xslt process, like external entities etc. *

    * @author Fotis Jannidis fotis@jannidis.de */ public class Xslt extends Task { - private String infile, outfile, xsltfile; - private String smart = "no"; //defaults to do conversion everytime task is called + private String infile, outfile, xsltfile; + private String smart = "no"; //defaults to do conversion everytime task is called + private String dependent = "none"; //defaults to no dependencies + private boolean startXslt = false; - /** - * Calls Xalan and does the transformation - * - */ + /** + * Sets the input file + * + */ + public void setInfile (String infile) { + this.infile = infile; + } - private void transform(String xmlSourceURL, String xslURL, String outputURL) - throws java.io.IOException, - java.net.MalformedURLException, - org.xml.sax.SAXException { - - // Use XSLTProcessor to instantiate an XSLTProcessor. - org.apache.xalan.xslt.XSLTProcessor processor = - org.apache.xalan.xslt.XSLTProcessorFactory.getProcessor(); - - // Create the 3 objects the XSLTProcessor needs to perform the transformation. - org.apache.xalan.xslt.XSLTInputSource xmlSource = - new org.apache.xalan.xslt.XSLTInputSource (infile); - org.apache.xalan.xslt.XSLTInputSource xslSheet = - new org.apache.xalan.xslt.XSLTInputSource (xsltfile); - org.apache.xalan.xslt.XSLTResultTarget xmlResult = - new org.apache.xalan.xslt.XSLTResultTarget (outfile); - - // Perform the transformation. - System.out.println("============================"); - System.out.println("xslt \nin: " + infile + "\nstyle: " + xsltfile + "\nout: " + outfile); - System.out.println("============================"); - processor.process(xmlSource, xslSheet, xmlResult); + /** + * Sets the stylesheet file + * + */ + public void setXsltfile (String xsltfile) { + this.xsltfile = xsltfile; + } + + /** + * Sets the output file + * + */ + public void setOutfile (String outfile) { + this.outfile = outfile; + } + + /** + * Sets the value for smart + * + * @param option valid values: + *

      + *
    • yes: check whether output file is older than input or stylesheet + *
    • no: (default) do conversion everytime task is called + *
    + */ + public void setSmart (String smart) { + this.smart = smart; + } + +/** + * Sets the value for dependent + * + * @param option valid values: + *
      + *
    • none: (default) + *
    • comma delimited list of files whose existence and date is checked + * against the output file + *
    + */ + public void setDependent (String dependent) { + this.dependent = dependent; + } + + /** + * Calls Xalan and does the transformation + * + */ + private void transform(String xmlSourceURL, String xslURL, String outputURL) + throws java.io.IOException, + java.net.MalformedURLException, + org.xml.sax.SAXException + { + // Use XSLTProcessor to instantiate an XSLTProcessor. + org.apache.xalan.xslt.XSLTProcessor processor = + org.apache.xalan.xslt.XSLTProcessorFactory.getProcessor(); + + // Create the 3 objects the XSLTProcessor needs to perform the transformation. + org.apache.xalan.xslt.XSLTInputSource xmlSource = + new org.apache.xalan.xslt.XSLTInputSource (infile); + org.apache.xalan.xslt.XSLTInputSource xslSheet = + new org.apache.xalan.xslt.XSLTInputSource (xsltfile); + org.apache.xalan.xslt.XSLTResultTarget xmlResult = + new org.apache.xalan.xslt.XSLTResultTarget (outfile); + // Perform the transformation. + System.out.println("============================"); + System.out.println("xslt \nin: " + infile + "\nstyle: " + xsltfile + "\nout: " + outfile); + System.out.println("============================"); + processor.process(xmlSource, xslSheet, xmlResult); + } //end transform + + /** + * Catches the errors transform() can throw and + * returns meaningfull error messages + */ + private void startTransform () { + try { + transform (infile,xsltfile,outfile); + } catch (org.xml.sax.SAXException saxerror) { + System.out.println("Task xslt - SAX ERROR:\n " + saxerror); + } catch (MalformedURLException urlerror) { + System.out.println("Task xslt - URL ERROR:\n " + urlerror); + } catch (IOException ioerror) { + System.out.println("Task xslt - IO ERROR:\n " + ioerror); + } + } //end startTransform + + /** + * Checks for existence of output file and compares + * dates with input and stylesheet file + */ + private boolean smartCheck (File outfileF, long outfileLastModified, File infileF, File xsltfileF) { + + if (outfileF.exists()) { + //checks whether output file is older than input file or xslt stylesheet file + if ((outfileLastModified < infileF.lastModified()) | + (outfileLastModified < xsltfileF.lastModified())) { + return true; + } + } else { + //if output file does not exist, start xslt process + return true; + } + return false; + } //end smartCheck + + /** + * Checks for existence and date of dependent files + * This could be folded together with smartCheck by using + * a general routine but it wouldn't be as fast as now + */ + private boolean dependenciesCheck(File outfileF, long outfileLastModified) { + String dependentFileName; + File dependentFile; + StringTokenizer tokens = new StringTokenizer(dependent,","); + while (tokens.hasMoreTokens()) { + dependentFileName = (String) tokens.nextToken(); + dependentFile = new File (dependentFileName); + //check: does dependent file exist + if (dependentFile.exists()) { + //check dates + if ((outfileLastModified < dependentFile.lastModified()) ) { + return true; } - - /** - * Sets the input file - * - */ - public void setInfile (String infile) { - this.infile = infile; - } + } else { + System.err.println("Task xslt - ERROR in attribute 'dependent':\n file " + dependentFileName + " does not exist."); + } + } + return false; + } //end dependenciesCheck + +/** + * Main method, which is called by ant. + * Checks for the value of smart and calls startTransform accordingly + */ + public void execute () throws org.apache.tools.ant.BuildException { + + File outfileF = new File (outfile); + File infileF = new File(infile); + File xsltfileF = new File (xsltfile); + long outfileLastModified = outfileF.lastModified(); + boolean startFileExist = true; - /** - * Sets the stylesheet file - * - */ - public void setXsltfile (String xsltfile) { - this.xsltfile = xsltfile; - } - - /** - * Sets the output file - * - */ - public void setOutfile (String outfile) { - this.outfile = outfile; - } - - /** - * Sets the value for smart - * - * @param option valid values: - *
      - *
    • yes: check whether output file is older than input or stylesheet - *
    • no: (default) do conversion everytime task is called - *
    - */ - public void setSmart (String smart) { - this.smart = smart; - } - + //checks whether input and stylesheet exist. + //this could be left to the parser, but this solution does make problems if smart is set to yes + if (!infileF.exists()) { + System.err.println("Task xslt - ERROR:\n Input file " + infile + " does not exist!"); + startFileExist = false; + } else if (!xsltfileF.exists()) { + System.err.println("Task xslt - ERROR:\n Stylesheet file " + xsltfile + " does not exist!"); + startFileExist = false; + } - /** - * Catches the errors transform() can throw and - * returns meaningfull error messages - */ - private void startTransform () { - try { - transform (infile,xsltfile,outfile); - } catch (org.xml.sax.SAXException saxerror) { - System.out.println("SAX Error: " + saxerror); - } catch (MalformedURLException urlerror) { - System.out.println("URL Error: " + urlerror); - } catch (IOException ioerror) { - System.out.println("IO Error: " + ioerror); - } - } - - /** - * Main method, which is called by ant. - * Checks for the value of smart and calls startTransform accordingly - */ - public void execute () throws org.apache.tools.ant.BuildException { - if (smart.equals("no")) { - startTransform(); - } else if (smart.equals("yes")) { - File outfileF = new File (outfile); - //checks for existence of output file - if (outfileF.exists()) { - //checks whether output file is older than input file or xslt stylesheet file - if ((outfileF.lastModified() < new File(infile).lastModified()) | (outfileF.lastModified() < new -File(xsltfile).lastModified())) { - startTransform(); - } - } else { - startTransform(); - } - //returns error message, if smart has another value as 'yes' or 'no' - } else { - System.err.println("Error: Allowed values for the attribute smart are 'yes' or 'no'"); - } - - } - //quick access for debugging - //usage XSLT infile xsltfile outfile (smart is 'yes') - /* - public static void main (String args[]) { - Xslt xslt = new Xslt(); - xslt.setInfile(args[0]); - xslt.setXsltfile(args[1]); - xslt.setOutfile(args[2]); - xslt.setSmart("yes"); - xslt.execute(); - } - */ - + //checks attribute 'smart' + if (smart.equals("no")) { + startXslt = true; + //if attribute smart = 'yes' + } else if (smart.equals("yes")) { + startXslt = smartCheck (outfileF,outfileLastModified,infileF,xsltfileF); + //checks dependent files against output file, makes only sense if smartCheck returns false + if (!dependent.equals("none") & (startXslt == false)) { + startXslt = dependenciesCheck(outfileF,outfileLastModified); + } + //returns error message, if smart has another value as 'yes' or 'no' + } else { + System.err.println("Task xslt - ERROR: Allowed values for the attribute smart are 'yes' or 'no'"); + } + if (startFileExist & startXslt) { + startTransform(); + } + } //end execute + + //quick access for debugging + //usage XSLT infile xsltfile outfile (smart is 'yes') + /* + public static void main (String args[]) { + Xslt xslt = new Xslt(); + xslt.setInfile(args[0]); + xslt.setXsltfile(args[1]); + xslt.setOutfile(args[2]); + xslt.setSmart("yes"); + xslt.setDependent("test1,test2"); + xslt.execute(); + } */ + }