浏览代码

added docs directory with readme and faq marked up in qaml and xslt for producing ascii, html and pdf. Contributed by Fotis Jannidis


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193245 13f79535-47bb-0310-9956-ffa450edef68
tags/RELEASE_0_12_0
jtauber 24 年前
父节点
当前提交
41a580e7a6
共有 7 个文件被更改,包括 1090 次插入0 次删除
  1. 67
    0
      docs/faq.xml
  2. 43
    0
      docs/qaml-html.css
  3. 303
    0
      docs/qaml-xml.dtd
  4. 225
    0
      docs/readme.xml
  5. 86
    0
      docs/xml2ascii.xsl
  6. 173
    0
      docs/xml2html.xsl
  7. 193
    0
      docs/xml2pdf.xsl

+ 67
- 0
docs/faq.xml 查看文件

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file uses the question and answer dtd
QAML Version 2.4. More info about it can be found in the dtd file.
There should be some xslt stylesheets in this distribution
which produce ascii, html and pdf files

Usage of attributes:
p: attr "class" can have "pre" (for code) or "li" for lists. No class attr is the normal
-->

<?xml-stylesheet type="text/css" href="qaml.css"?>
<!DOCTYPE faq SYSTEM "qaml-xml.dtd">

<faq>

<head>
<title>FOP - Frequently Asked Questions</title>
<version>1.0 1999/11/24 </version>
<maintain>
<name>James Tauber</name>
<name>Fotis Jannidis</name>
<email>jtauber@jtauber.com</email>
<email>jannidis@lrz.uni-muenchen.de</email><subject>FOP</subject>
</maintain>
</head>


<body>
<section class="level1">
<title>FAQ - Running FOP</title>

<qna>
<q>Q: Running FOP I get the following messages or something similar:
"WARNING: Unknown formatting object http://www.w3.org/XSL/Format/1.0^root"
and then a FATAL Error "Root element must be root, not default FO".</q>
<a>
<p>A: Make sure that you have specified as the namespace for fo the
following string: "http://www.w3.org/1999/XSL/Format". It is analogous
to the xslt namespace "http://www.w3.org/1999/XSL/Transform"
</p>
</a>
</qna>

<!-- Template for next question
<qna>
<q></q>
<a><p></p></a>
</qna>
-->

</section>


<!-- Template for compiling section
<section class="level1">
<title>FAQ - Compiling FOP</title>

<qna>
<q></q>
<a><p></p></a>
</qna>
</section>
-->

</body>
</faq>


+ 43
- 0
docs/qaml-html.css 查看文件

@@ -0,0 +1,43 @@
/* Use Times New Roman for default font */


body {
background-color:#FFFF99;
font-family: serif,Times,"Times New Roman";
font-size: 12pt;
margin-left: 20%;
margin-right: 20%;
}

h1 {
font-size: 16pt;
margin-top: 5pt;
margin-bottom: 5pt;

}

h1.title {
font-size: 18pt;
margin-top: 10pt;
margin-bottom: 10pt;
}

h2 {
font-size: 14pt;
}

h3 {
font-size: 12pt;
font-weight: bold;
}


p.pre {
font-family: monospace,Courier,"Courier New";
font-size: 10pt;
}

p.contact {
font-size: 9pt;
text-align= right;
}

+ 303
- 0
docs/qaml-xml.dtd 查看文件

@@ -0,0 +1,303 @@
<!--
This is an XML DTD for writing Frequently Asked Questions FAQs.
QAML Version 2.4 last modified Oct 6 1999
by Justin Higgins (jhiggins@dn.net)
www.faq.org
and Rick Jelliffe (ricko@gate.sinica.edu.tw)
www.ascc.net/xml/
It is based on the QAML 1.0 DTD, with minimal alterations
for XML, I18N (internationalization), XLL hypertext linking,
style, accessability and tracking. Multi-part answers are
supported a little better. Corporate and "look-and-feel"
needs are supported better: rights, PICS, logos, advertising
sections, corporate addresses.
* XML: Documents written using the QAML 1.0 DTD
are structurally compatible with this DTD; however, such
documents need to be converted into "well-formed" XML:
make sure they are fully tagged with start-end tags for
every element. If you are not using 7-bit ACSCII or
UTF-8, specify the appropriate XML encoding header. If you are
not using English, specify the appropriate xml:lang language
attributes. Use lower-case element type names.
* I18N: All elements with data content, and the top element,
may have a language attribute. People may have alternative names
in different scripts: e.g., a Chinese name and an English
name.
* XLink: All elements may have an ID attribute. A fixed xml:link
attribute has been added to link and archive, for housekeeping.
(Link is used like HTML's <a> and <img> and <link> element types.
Archive points to the official location of the current and
precious version of the FAQ, and to translations.)
Note that the xml:show attribute is available in this DTD, but
may not be available at the user's system. The following
link roles are defined by this DTD, but you can add your own:
"Text", "Image", "Sound", "Software", "Data", "Interactive"
are the base Dublin Core categories for the resource types.
A logo is a special XLink: it just points to some icon or logo
or picture. (The logo does not represent a clickable hypertext
link: it is just for graphical purposes.) The link elements at
the start of the head element are intended for similar uses as
the HTML link element type: a role "bgimage" is defined by this DTD.

* Style: An element "span" is introduced with the same use as in HTML.
All elements have a class attribute, which may help better
processing in CSS. The following classes are defined by this DTD,
but you can add your own:
For section elements: "intro" (a preamble), "rights" (copyright),
"advert" (for advertising), "info" (for corporate info about the
siteowner, subject, product, or sponsor) and "links" (related sites);
For p elements: "li" and "pre", with the HTML meanings: there
is no provision for nested lists or tables;
For span elements: "tt", "em", "i", "b" & "strong", with the HTML meanings;
Also: "definition" and "keyword", for indexing
For p and span elements: "sent", with the JSML meaning
(a sentence);
For the span element type: "literal" with the JSML meaning
(to be spelled out as letters)-this helps WAI too;
For the span element type: "abbr" and "acronym" are also available,
(an acronym is pronouncable: NASA), roughly from HTML
For the div element type: "ul" and "ol" with the HTML meanings.
The div element type is new with QAML 2.1; we found we could
not create good HTML lists without it. However, we have not
allowed nested lists with it, at this stage.
Note: if you use class="pre", also specify xml:space="preserve"
to inhibit the stripping of white space by the XML processor.
If you are attempting "ASCII art", use
<p class="pre" xml:space="preserve" alt="explanatory text">...
where the alt attribute holds some explanatory text.
Please note that you should not rely on format effects
(font, boldness) to convey meaning in these FAQs. The output
system of the user may not support them.
If you do not put your own numbers in titles, you can signify this
by specifying the autonum attribute on a body or section to "yes".
* Accessability: QAML has been checked against the W3C WAI guidelines;
the link, p & span elements can have an "title" attribute.
The span element can have a class="literal", for contractions to be
spoken out in individual letters, "abbr" for an abbreviations,
and "acronym" for acronyms. The latter two may be marked up with
title attribute for better pronunciation. Multiple logos are possible,
to allow sound as well as visual logos.
Refer /www.w3.org/TR/WD-WAI-PAGEAUTH/
* Dublin Core: The mappings to Dublin Core metadata are noted.
The Dublin Core type for FAQs is "faq". (The althdr element
can be used similar to the HTML meta element, to add arbitrary
kinds of metadata.)
* Tracking: A data attribute has been added to various elements.
Use an ISO 8601 format date: yyyy-mm-dd or yyyymmdd.
The archive element can link to previous versions and translations.
The maintainer can advise the preferred subject line to be used
in emails about the FAQ, using the element type "subject".
A version element has been added to element type head
* PICS and rights: PICS labels can be added to the header using the
label element type. Refer http://www.w3.org/PICS/
A text version concerning rights can be given in a section
with a class="rights" attribute.
* PDA and Wireless Systems: to allow better interaction with PDA and
wireless systems, which have very small screen real-estate, the
<a> answer element type can take a "gist" attribute: this can have
a 1 to 5 word summary of the answer. The PDA would use that for example:
Q: What is a dog?
A: Barking animal >more>
Q: Are dogs cats?
A: No! >more>
where the ">more>" links to the full answer.
QAML Version 1.0 last modified 16 July 1997
by Justin Higgins (jhiggins@dn.net)
Public identifier for SGML version of QAML Version 1,0:
+//ISBN 82-7640-023//DTD Frequently Asked Questions//EN//19940603
Public identifier for this XML version:
+//IDN faq.org//DTD Frequently Asked Questions 2.3//EN//XML
Rights: This DTD is copyright 1994-1999 Justin Higgins and Rick
Jelliffe. You can use it freely for any purpose under the terms
of the MPL or GPL. Documents created using this DTD are copyright
their (human or corporate) authors and maintainers, subject to
local law, unless explicitly noted in the FAQ text or markup.
Thanks: Eric Luhrs, C.T.Chang, Andy Leighton, David Pawson
Notice: ID attributes will soon be made #REQUIRED on section and on
qna. Please always use them.
-->
<!-- New in version 2.4
email not mandatory for authors and contributors
block of links allowed at start of head
-->
<!-- New in version 2.3
Version element added
Allow someone to have more than one email address (deprecated)
Namespace declaration added
-->
<!ELEMENT faq (head, body) >
<!ELEMENT a (p | div)+ >
<!ELEMENT address (#PCDATA) >
<!ELEMENT althdr (type, content) ><!-- DC:DESCRIPTION -->
<!ELEMENT archive (#PCDATA) ><!-- DC:IDENTIFIER? -->
<!ELEMENT author (logo*, name+, email?) ><!-- DC:CREATOR -->
<!ELEMENT body (section+ | qna+) >
<!ELEMENT content (#PCDATA) >
<!ELEMENT contributor (logo*, name, email?) ><!-- DC:CONTRIBUTOR -->
<!ELEMENT div (p)+ >
<!ELEMENT email (#PCDATA) >
<!ELEMENT head (title, version?, maintain+, hdr*, althdr*, archive*,label*, link*)>
<!ELEMENT hdr (type, content) ><!-- DC:DESCRIPTION -->
<!ELEMENT label (#PCDATA) >
<!ELEMENT link (#PCDATA) >
<!ELEMENT logo (#PCDATA) >
<!ELEMENT maintain (logo*, name+, email+, subject?, address?) >
<!-- DC:AUTHOR or DC:PUBLISHER -->
<!ELEMENT name (#PCDATA) >
<!ELEMENT p (#PCDATA | link | span)* >
<!ELEMENT q (#PCDATA | link | span)* >
<!ELEMENT qna (logo*, q, (logo?,topic?,author?,contributor*,a)+)>
<!ELEMENT section (logo*, title, (qna+ | q+ | ( p | div | section)+)) >
<!ELEMENT span (#PCDATA) >
<!ELEMENT subject (#PCDATA) >
<!ELEMENT title (#PCDATA) ><!-- DC:TITLE -->
<!ELEMENT topic (#PCDATA) ><!-- DC:TITLE -->
<!ELEMENT type (#PCDATA) ><!-- DC:SUBJECT -->
<!ELEMENT version (#PCDATA) >
<!-- Type categories include:
Animals
Art
Audio
Business & Finance
Computers
Programming
Software
Countries
Food
Games
Health
History
Hobbies
Internet
Learning
Misc.
Movies
Music
People
Politics & Law
Books & Magazines
Religion
Science
Sports
Technology
Television & Radio -->
<!ATTLIST a id ID #IMPLIED
class CDATA #IMPLIED
gist CDATA #IMPLIED
xml:lang CDATA #IMPLIED >
<!ATTLIST archive href CDATA #REQUIRED
type CDATA #IMPLIED
class CDATA #IMPLIED
xml:link CDATA #FIXED "simple" >
<!ATTLIST author id ID #IMPLIED
class CDATA #IMPLIED >
<!ATTLIST althdr id ID #IMPLIED
class CDATA #IMPLIED
schema CDATA #IMPLIED >
<!ATTLIST div id ID #IMPLIED
class CDATA #IMPLIED
xml:lang NMTOKEN #IMPLIED >
<!ATTLIST body id ID #IMPLIED
class CDATA #IMPLIED
xml:lang NMTOKEN #IMPLIED
autonum ( yes | no ) "no" >
<!ATTLIST content id ID #IMPLIED
class CDATA #IMPLIED >
<!ATTLIST contributor id ID #IMPLIED
class CDATA #IMPLIED >
<!ATTLIST email id ID #IMPLIED
class CDATA #IMPLIED >
<!ATTLIST faq id ID #IMPLIED
xmlns:html CDATA #FIXED "http://www.w3.org/TR/REC-html40"
class CDATA #IMPLIED
xml:lang NMTOKEN #IMPLIED
date CDATA #IMPLIED ><!-- DC:DATE -->
<!ATTLIST head id ID #IMPLIED
class CDATA #IMPLIED >
<!ATTLIST hdr id ID #IMPLIED
class CDATA #IMPLIED
schema CDATA #IMPLIED >
<!ATTLIST label PICSversion CDATA #IMPLIED >
<!ATTLIST link id ID #IMPLIED
class CDATA #IMPLIED
xml:link CDATA #FIXED "simple"
href CDATA #REQUIRED
alt CDATA #IMPLIED
role CDATA #IMPLIED
title CDATA #IMPLIED
show (embed|replace|new) "new"
actuate (auto|user) "user"
behavior CDATA #IMPLIED >
<!ATTLIST logo
id ID #IMPLIED
class CDATA #IMPLIED
alt CDATA #IMPLIED
href CDATA #REQUIRED
xml:lang NMTOKEN #IMPLIED
xml:link CDATA "simple"
show (embed) "embed"
actuate (auto|user) "auto" >
<!ATTLIST maintain id ID #IMPLIED
class CDATA #IMPLIED >
<!ATTLIST name id ID #IMPLIED
class CDATA #IMPLIED >
<!ATTLIST p id ID #IMPLIED
class CDATA #IMPLIED
title CDATA #IMPLIED
xml:lang NMTOKEN #IMPLIED
alt CDATA #IMPLIED
date CDATA #IMPLIED
xml:space ( default | preserve ) #IMPLIED >
<!ATTLIST q id ID #IMPLIED
class CDATA #IMPLIED
xml:lang NMTOKEN #IMPLIED >
<!ATTLIST qna id ID #IMPLIED
class CDATA #IMPLIED
xml:lang NMTOKEN #IMPLIED
date CDATA #IMPLIED >
<!ATTLIST section id ID #IMPLIED
class CDATA #IMPLIED
gist CDATA #IMPLIED
xml:lang NMTOKEN #IMPLIED
autonum ( yes | no ) "no" >
<!ATTLIST span id ID #IMPLIED
class CDATA #IMPLIED
title CDATA #IMPLIED
xml:lang NMTOKEN #IMPLIED >
<!ATTLIST title id ID #IMPLIED
class CDATA #IMPLIED
xml:lang NMTOKEN #IMPLIED >
<!ATTLIST topic id ID #IMPLIED
class CDATA #IMPLIED
xml:lang NMTOKEN #IMPLIED
alt CDATA #IMPLIED >
<!ATTLIST type id ID #IMPLIED
class CDATA #IMPLIED >
<!-- Why use QAML instead of HTML?
Because unconstrained HTML is too powerful and loose! -->



+ 225
- 0
docs/readme.xml 查看文件

@@ -0,0 +1,225 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file uses the question and answer dtd
QAML Version 2.4. More info about it can be found in the dtd file.
There should be some xslt stylesheets in this distribution
which produce ascii, html and pdf files

Usage of attributes:
section: attr "class" has the value "level1", "level2" etc. to mark the level of nesting
p: attr "class" can have "pre" (for code) or "li" for lists. No class attr is the normal
-->

<?xml-stylesheet type="text/css" href="qaml.css"?>
<!DOCTYPE faq SYSTEM "qaml-xml.dtd">

<faq>

<head>
<title>FOP</title>
<version>1.0 1999/11/24 </version>
<maintain>
<name>James Tauber</name>
<name>Fotis Jannidis</name>
<email>jtauber@jtauber.com</email>
<email>jannidis@lrz.uni-muenchen.de</email><subject>FOP</subject>
</maintain>
</head>

<body>

<section class="level1">
<title>What is FOP?</title>
<p>FOP is the world's first print formatter driven by XSL
formatting objects. It is a Java 1.1 application that reads a
formatting object tree and then turns it into a PDF document.
The formatting object tree, can be in the form of an XML
document (output by an XSLT engine like XT or Xalan) or can be
passed in memory as a DOM Document or (in the case of
XT or Xalan) SAX events.
</p>
<p>FOP is part of Apache's XML project. The homepage of FOP is
<link href="http:/xml.apache.org/fop">http:/xml.apache.org/fop</link>.
</p>
</section>

<section class="level1">
<title>Compiling FOP</title>
<section class="level2">
<title>1. Prerequisites</title>
<section class="level3">
<title>a) Java 1.1.x or later</title>
<p></p>
</section>
<section class="level3">
<title>b) XT from James Clark</title>
<p>Some of the Java source code in FOP is generated from XML using
XSLT. XT must be used to generate this code.</p>
<p>XT is an XSL stylesheet processor written in java. At the moment you
can't use any other processor, because the make file makes use of some
proprietary features of Clark's xt which allow to write output in more
then one document. You can find XT at <link href="http://www.jclark.com/xml/xt.html">
James Clark's website</link>. You have to use XT version 19991105 or later.</p>
<p>(Under windows you shouldn't use the prepackaged xt.exe but also the
generic jar file, otherwise make won't work)
</p>
<p>XT relies on an sax parser like XP (also J. Clark), which can be
downloaded at <link href="http://www.jclark.com/xml/xp/index.html">James
Clark's Website</link>
</p>
</section>
<section class="level3">
<title>c) make</title>
<p>Under windows it has been reported that the use of the cygnus solutions port
of the GNU utilities works. You can find it at
<link href="http://sourceware.cygnus.com/cygwin/">Cygnus Solutions</link>
</p>
</section>
</section>
</section>

<section class="level1">
<title>Running FOP</title>
<section class="level2">
<title>1) Prerequisites</title>
<p>Following software must be installed:</p>
<p>a) Java 1.1.x or later</p>
<p>b) A sax parser like <link href="http://www.jclark.com/xml/xp/index.html">XP</link>.</p>
<p>c) If you have to produce the flow objects files, which are the input for FOP,
you need a transformation utility to create this files from your xml files.
Normally this is an XSLT stylesheet processor like
<link href="http://www.jclark.com/xml/xt.html">XT</link>
or <link href="http://xml.apache.org/xalan/index.html">XALAN</link>.
</p>
</section>
<section class="level2">
<title>2) Starting FOP as an standalone application</title>
<p>There are two ways of running FOP from the command line.</p>
<section class="level3">
<title>a) Method One</title>
<p>One is to first use an XSLT engine to produce the formatting object tree as an
XML document and then running the class org.apache.fop.apps.CommandLine with the
formatting object file name and PDF filename as arguments. You will need to include
FOP, SAX and your SAX Parser in your classpath and so you might invoke
</p>
<p class="pre">java -cp fop_x_xx_x.jar;sax.jar;xp.jar</p>
<p class="pre">org.apache.fop.apps.CommandLine formatting-tree-file pdf-file</p>
<p>If your SAX Parser is other than XP, you will need to set the property
org.xml.sax.parser to the SAX Parser class to use.
</p>
</section>
<section class="level3">
<title>b) Method Two</title>
<p>Rather than performing transformation with an XSLT before invoking FOP, it is
possible, if you use XT as your XSLT engine, to just call FOP and have it call
XT for you. To do this, run the class org.apache.fop.apps.CommandLine with the
source XML file name, XSL file name and PDF file name as arguments. You will
need to include FOP, SAX, your SAX Parser and XT in your classpath and so you might
invoke
</p>
<p class="pre">java -cp fop_x_xx_x.jar;sax.jar;xp.jar;xt.jar</p>
<p class="pre">org.apache.fop.apps.CommandLine xml-file xsl-file pdf-file</p>
<p>Again, if your SAX Parser is other than XP, you will need to set the property
org.xml.sax.parser to the SAX Parser class to use.
</p>
<p>Note: If you are using java 2 or later (i.e. jdk 1.2. or later) you can put all
needed jar files into the subdirectory jdk1.2.x\jre\lib\ext (windows example). Then
FOP can be started without classpath:
</p>
<p class="pre">java org.apache.fop.apps.CommandLine formatting-tree-file pdf-file</p>
</section>
</section>
</section>

<section class="level1">
<title>What's Implemented?</title>
<section class="level2">
<title>a) Formatting Objects</title>
<div class="list">
<p class="li">root </p>
<p class="li">layout-master-set </p>
<p class="li">simple-page-master </p>
<p class="li">region-body </p>
<p class="li">region-before </p>
<p class="li">region-after </p>
<p class="li">page-sequence </p>
<p class="li">sequence-specification </p>
<p class="li">sequence-specifier-single </p>
<p class="li">sequence-specifier-repeating </p>
<p class="li">sequence-specifier-alternating </p>
<p class="li">flow </p>
<p class="li">static-content </p>
<p class="li">block </p>
<p class="li">list-block </p>
<p class="li">list-item </p>
<p class="li">list-item-label </p>
<p class="li">list-item-body </p>
<p class="li">page-number </p>
<p class="li">display-sequence </p>
<p class="li">inline-sequence </p>
<p class="li">display-rule </p>
<p class="li">display-graphic </p>
</div>
</section>
<section class="level2">
<title>b) Properties</title>
<div class="list">
<p class="li">end-indent </p>
<p class="li">page-master-name </p>
<p class="li">page-master-first </p>
<p class="li">page-master-repeating </p>
<p class="li">page-master-odd </p>
<p class="li">page-master-even </p>
<p class="li">margin-top </p>
<p class="li">margin-bottom </p>
<p class="li">margin-left </p>
<p class="li">margin-right </p>
<p class="li">extent </p>
<p class="li">page-width </p>
<p class="li">page-height </p>
<p class="li">flow-name </p>
<p class="li">font-family </p>
<p class="li">font-style </p>
<p class="li">font-weight </p>
<p class="li">font-size </p>
<p class="li">line-height </p>
<p class="li">text-align </p>
<p class="li">text-align-last </p>
<p class="li">space-before.optimum </p>
<p class="li">space-after.optimum </p>
<p class="li">start-indent </p>
<p class="li">end-indent </p>
<p class="li">provisional-distance-between-starts </p>
<p class="li">provisional-label-separation </p>
<p class="li">rule-thickness </p>
<p class="li">color </p>
<p class="li">wrap-option </p>
<p class="li">white-space-treatment </p>
<p class="li">break-before </p>
<p class="li">break-after </p>
<p class="li">text-indent </p>
<p class="li">href</p>
</div>
</section>
</section>

<section class="level1">
<title>Bugs</title>
<p> </p>
</section>

<section class="level1">
<title>FOP Relevant Specifications</title>
<div class="list">
<p class="li"><link href="http://www.w3.org/TR/REC-xml">XML Recommendation</link></p>
<p class="li"><link href="http://www.w3.org/TR/WD-xsl/">XSL-FO Working Draft</link></p>
<p class="li"><link href="http://www.w3.org/TR/xslt">XSLT Recommandation</link></p>
<p class="li"><link href="http://partners.adobe.com/asn/developer/acrosdk/DOCS/pdfspec.pdf">PDF Documentation</link></p>
<p class="li"><link href="http://www.megginson.com/SAX/">Simple API for XML (SAX)</link></p>
<p class="li"><link href="http://www.w3.org/TR/REC-DOM-Level-1">Document Object Model (DOM)</link></p>
<p class="li"><link href="http://www.w3.org/TR/REC-xml-names/">Namespaces in XML Recommendation</link></p>
<p class="li"><link href="http://java.sun.com/products/jdk/1.1/docs/index.html">Java JDK 1.1 Documentation</link></p>
</div>
</section>

</body>
</faq>

+ 86
- 0
docs/xml2ascii.xsl 查看文件

@@ -0,0 +1,86 @@
<?xml version="1.0"?>
<!-- XSLT stylesheet: QAML -> No Markup (QAML = FAQ Markup Language)
author: F. Jannidis <jannidis@.lrz.uni-muenchen.de>
version: 1.00ß
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match ="/">
<xsl:apply-templates/>
</xsl:template>

<!-- writes the header of the html file with a link to css stylesheet-->
<xsl:template match ="head">
<xsl:apply-templates/>
</xsl:template>

<!-- don't output maintain and version-->
<xsl:template match ="maintain">
</xsl:template>
<xsl:template match ="version">
</xsl:template>

<!-- header title -->
<xsl:template match ="head/title">
<xsl:apply-templates/>
</xsl:template>

<!-- body -->
<xsl:template match ="body">
<!-- generates table of contents with links to the different levels-->
<xsl:for-each select="section[@class='level1']/title">
<xsl:text>&#10;</xsl:text><xsl:number value="position()"/>) <xsl:value-of select="."/>
</xsl:for-each>

<!-- processing of the rest -->
<xsl:apply-templates/>

<!-- writes the footer -->

Version: <xsl:value-of select="/faq/head/version"/> -
Contact: <xsl:value-of select="//head/maintain/name"/> (<xsl:value-of select="//head/maintain/email"/>)
</xsl:template>

<!-- title level1, numbering is generated -->
<xsl:template match ="section[@class='level1']/title">
<xsl:number count="section[@class='level1']"/>) <xsl:apply-templates/>
</xsl:template>

<!-- title level2 -->
<xsl:template match ="section[@class='level2']/title">
<xsl:apply-templates/>
</xsl:template>

<!-- title level3 -->
<xsl:template match ="section[@class='level3']/title">
<xsl:apply-templates/>
</xsl:template>

<!-- question -->
<xsl:template match ="q">
<xsl:apply-templates/>
</xsl:template>

<!-- answer -->
<xsl:template match ="a">
<xsl:apply-templates/>
</xsl:template>

<!-- para -->
<xsl:template match ="p">
<xsl:apply-templates/>
</xsl:template>

<!-- test span -->
<xsl:template match ="span">
<xsl:apply-templates/>
</xsl:template>

<!-- links -->
<xsl:template match ="link">
<xsl:apply-templates/> (<xsl:value-of select="@href"/>)
</xsl:template>

</xsl:stylesheet>



+ 173
- 0
docs/xml2html.xsl 查看文件

@@ -0,0 +1,173 @@
<?xml version="1.0"?>
<!-- XSLT stylesheet: QAML -> HTML (QAML = FAQ Markup Language)
author: F. Jannidis <jannidis@.lrz.uni-muenchen.de>
version: 1.00ß
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>


<xsl:template match ="/">
<html>
<xsl:apply-templates/>
</html>
</xsl:template>


<!-- writes the header of the html file with a link to css stylesheet-->
<xsl:template match ="head">
<head>
<link rel="stylesheet" type="text/css" href="qaml-html.css"></link>
<xsl:apply-templates/>
</head>
</xsl:template>

<!-- don't output all of maintain and version-->
<xsl:template match ="maintain">
</xsl:template>
<xsl:template match ="version">
</xsl:template>


<!-- header title -->
<xsl:template match ="head/title">
<title>
<xsl:apply-templates/>
</title>
</xsl:template>


<!-- body -->
<xsl:template match ="body">
<body>
<!-- defines text title -->
<h1 class="title"><xsl:value-of select="//head/title"/></h1>

<!-- generates table of contents with links to the different levels-->
<p>
<xsl:for-each select="section[@class='level1']/title">
<xsl:number value="position()"/>)
<a href="">
<xsl:attribute name="href">
#<xsl:number count="section[@class='level1']"/>
</xsl:attribute>
<xsl:value-of select="."/>
</a>
<br/>
</xsl:for-each>
</p>
<!-- processing of the rest -->
<xsl:apply-templates/>

<!-- writes the footer -->
<hr/>
<p class="contact">
Version: <xsl:value-of select="/faq/head/version"/> -
Contact:
<a>
<xsl:attribute name="href">
mailto:<xsl:value-of select="//head/maintain/email"/>
</xsl:attribute>
<xsl:value-of select="//head/maintain/name"/>
</a>
</p>
</body>
</xsl:template>

<!-- title level1, numbering is generated -->
<xsl:template match ="section[@class='level1']/title">
<h1>
<a>
<xsl:attribute name="name">
<xsl:number count="section[@class='level1']"/>
</xsl:attribute>
</a>
<xsl:number count="section[@class='level1']"/>)
<xsl:apply-templates/>
</h1>
</xsl:template>

<!-- title level2 -->
<xsl:template match ="section[@class='level2']/title">
<h2>
<xsl:apply-templates/>
</h2>
</xsl:template>

<!-- title level3 -->
<xsl:template match ="section[@class='level3']/title">
<h3>
<xsl:apply-templates/>
</h3>
</xsl:template>

<!-- question -->
<xsl:template match ="q">
<p class="question">
<xsl:apply-templates/>
</p>
</xsl:template>

<!-- answer -->
<xsl:template match ="a">
<xsl:apply-templates/>
</xsl:template>

<!-- para in answer -->
<xsl:template match ="a/p">
<p class="answer">
<xsl:apply-templates/>
</p>
</xsl:template>

<!-- test span -->
<xsl:template match ="span">
<b><xsl:apply-templates/> </b>
</xsl:template>

<!-- list -->
<xsl:template match ="div[@class='list']">
<ul>
<xsl:apply-templates/>
</ul>
</xsl:template>

<!-- list items -->
<xsl:template match ="div/p[@class='li']">
<li>
<xsl:apply-templates/>
</li>
</xsl:template>


<!-- code fragments, marked by attribute pre -->
<xsl:template match ="section/p[@class='pre']">
<p>
<xsl:attribute name="class">
<xsl:value-of select="@class"/>
</xsl:attribute>
<xsl:apply-templates/>
</p>
</xsl:template>


<!-- normal paras without class attribute -->
<xsl:template match ="section/p[not(@class)]">
<p>
<xsl:apply-templates/>
</p>
</xsl:template>


<!-- links -->
<xsl:template match ="link">
<a>
<xsl:attribute name="href">
<xsl:value-of select="@href"/>
</xsl:attribute>
<xsl:apply-templates/>
</a>
</xsl:template>

</xsl:stylesheet>


+ 193
- 0
docs/xml2pdf.xsl 查看文件

@@ -0,0 +1,193 @@
<?xml version="1.0"?>
<!-- XSLT stylesheet: QAML -> FO (QAML = FAQ Markup Language)
version: 1.00ß
-->

<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
result-ns="fo" indent-result="yes">

<xsl:output indent="yes"/>

<xsl:template match ="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

<!-- definiert die Druckseiten -->
<fo:layout-master-set>

<fo:simple-page-master page-master-name="first"
height="29.7cm" width="21cm"
margin-top="1cm" margin-bottom="2cm"
margin-left="2.5cm" margin-right="2.5cm">
<fo:region-before extent="3cm"/>
<fo:region-body margin-top="3cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>

<fo:simple-page-master page-master-name="rest"
height="29.7cm" width="21cm"
margin-top="1cm" margin-bottom="2cm"
margin-left="2.5cm" margin-right="2.5cm">
<fo:region-before extent="2.5cm"/>
<fo:region-body margin-top="2.5cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>

</fo:layout-master-set>

<fo:page-sequence>
<fo:sequence-specification>
<fo:sequence-specifier-repeating page-master-first="first"
page-master-repeating="rest"/>
</fo:sequence-specification>

<fo:static-content flow-name="xsl-before">
<fo:block text-align="end"
font-size="10pt"
font-family="serif"
line-height="14pt" >
FOP - p. <fo:page-number/>
</fo:block>
</fo:static-content>

<fo:flow flow-name="xsl-body">
<xsl:apply-templates select="faq"/>
</fo:flow>

</fo:page-sequence>
</fo:root>
</xsl:template>

<!-- don't output head -->
<xsl:template match ="head">
</xsl:template>


<!-- body -->
<xsl:template match ="body">
<!-- defines text title -->
<fo:block font-size="24pt"
font-family="serif"
line-height="24pt"
space-after.optimum="15pt">
<xsl:value-of select="//head/title"/>
</fo:block>

<!-- processing of the rest -->
<xsl:apply-templates/>
</xsl:template>



<!-- title level1, numbering is generated -->
<xsl:template match ="section[@class='level1']/title">
<fo:block font-size="18pt"
font-family="serif"
line-height="20pt"
space-before.optimum="20pt"
space-after.optimum="14pt"
keep-with-next="true">
<xsl:number count="section[@class='level1']"/>)
<xsl:apply-templates/>
</fo:block>
</xsl:template>

<!-- title level2 -->
<xsl:template match ="section[@class='level2']/title">
<fo:block font-size="16pt"
font-family="serif"
line-height="18pt"
space-before.optimum="8pt"
space-after.optimum="8pt"
keep-with-next="true">
<xsl:apply-templates/>
</fo:block>
</xsl:template>

<!-- title level3 -->
<xsl:template match ="section[@class='level3']/title">
<fo:block font-size="14pt"
font-family="serif"
line-height="16pt"
space-before.optimum="8pt"
space-after.optimum="4pt"
keep-with-next="true">
<xsl:apply-templates/>
</fo:block>
</xsl:template>

<xsl:template match ="section">
<xsl:apply-templates/>
</xsl:template>

<!-- question group -->
<xsl:template match ="qna">
<xsl:apply-templates/>
</xsl:template>

<!-- question -->
<xsl:template match ="q">
<fo:block start-indent="0.7cm"
space-before.optimum="12pt">
<xsl:value-of select="."/>
</fo:block>
</xsl:template>

<!-- para in answer -->
<xsl:template match ="a/p">
<fo:block start-indent="0.7cm">
<xsl:apply-templates/>
</fo:block>
</xsl:template>

<!-- list -->
<xsl:template match ="div[@class='list']">
<fo:list-block start-indent="1cm"
provisional-label-separation="3pt"
provisional-distance-between-starts="6pt">
<xsl:apply-templates/>
</fo:list-block>
</xsl:template>

<!-- list items -->
<xsl:template match ="div/p[@class='li']">
<fo:list-item>
<fo:list-item-label><fo:block>*</fo:block></fo:list-item-label>
<fo:list-item-body>
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</xsl:template>


<!-- code fragments, marked by attribute pre -->
<xsl:template match ="section/p[@class='pre']">
<fo:block font-size="10pt"
font-family="monospace"
line-height="12pt"
space-before.optimum="3pt"
space-after.optimum="3pt">
<xsl:apply-templates/>
</fo:block>
</xsl:template>

<!-- normal paras without class attribute -->
<xsl:template match ="section/p[not(@class)]">
<fo:block space-after.optimum="3pt">
<xsl:apply-templates/>
</fo:block>
</xsl:template>

<!-- link -->
<xsl:template match ="link">
<fo:inline-sequence font-style="italic"
font-family="sans-serif">
<xsl:apply-templates/>
</fo:inline-sequence>
(<xsl:value-of select="@href"/>)
</xsl:template>

</xsl:stylesheet>

正在加载...
取消
保存