forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ross Gardler <>
Subject docv12txt.xsl
Date Mon, 26 Jan 2004 13:59:18 GMT
I recently found the need to create a stylesheet to convert xdocs to
text. It's not quite fully complete, in particular tables are not too
well represented at present (I don't need them in my use case at present).

I've copied the output of using
this stylesheet below. Would this be of use in CVS?


Ouput of
NB Mail client will have wrapped long lines not
the stylesheet.

The document-v1.2 DTD

This document doesn't make any sense at all.

A nonsense document using all possible elements in the current
document-v12.dtd .

Changes since document-v11

doc-v12 enhances doc-v11 by relaxing various restrictions that were
found to be unnecessary.

   * Links (link,jump,fork) and inline elements (br,img,icon,acronym)
are allowed inside title.
   * Paragraphs (p,source,note,warning,fixme), table and figure,anchor
are allowed inside li.
   * Paragraphs (p,source,note,warning,fixme), lists (ol,ul,dl), table,
figure,anchor are allowed inside definition lists (dd) and tables (td
and dh).
   * Inline content
(strong,em,code,sub,sup,br,img,icon,acronym,link,jump,fork) is allowed
in strong and em.

Sample Content

Hint: See the xml source to see how the various elements are used and
see the DTD documentation.

This is a simple paragraph. Most documents contain a fair amount of
paragraphs. Paragraphs are called <p>.
With the <p xml:space="preserve"> attribute, you can declare that
whitespace should be preserved, without implying it is in any other way
A number of in-line elements are available in the DTD, we will show them
inside an unordered list (<ul>):

   * Here is a simple list item ( <li> ).
   * Have you seen the use of the <code> element in the previous item?
   * Also, we have <sub> and <sup> elements to show
contentaboveorbelowthe text baseline.
   * There is a facility toemphasizecertain words using the <em>
<strong> elements.
   * We can use <icon> s, too.
   * Another possibility is the <img> element:, which offers the ability
to refer to an image map.
   * We have elements for hyperlinking:
          <link href="faq.html">
             Use this to link [See link target: faq.html] to another
document. As per normal, this will open the new document in the same
browser window.
          <link href="#section">
             Use this to link [See link target: #section] to the named
anchor in the current document.
          <link href="contrib.html#cvshowto">
             Use this to link [See link target: contrib.html#cvshowto]
to another document and go to the named anchor. This will open the new
document in the same browser window.
          <jump href="contrib.html">
             Use this to jump [See link target: contrib.html] to another
document and optionally go to a named anchor [See link target:
contrib.html#cvshowto] within that document. This will open the new
document in the same browser window. So what is the difference between
link and jump? The jump behaves differently, in that it will replace any
frames in the current window. This is the equivalent of <a ...
          <fork href="faq.html">
             Use this to fork [See link target: faq.html] your
webbrowser to another document. This will open the document in a new,
unnamed browser window. This is the equivalent of <a ... target="_blank">
   * Oh, by the way, a definition list <dl> was used inside the previous
list item. We could put another
     * unordered list
     * inside the list item                   A sample nested table

| Or even tables | inside lists | |

So far for the in-line elements, let's look at some paragraph-level

Fixme (SN)
The <fixme> element is used for stuff which still needs work. Mind the
author attribute!

Use the <note> element to draw attention to something, e.g. ...The
<code> element is used when the author can't express himself clearly
using normal sentences ;-)

Sleep deprivation can be the result of being involved in an open source
project. (a.k.a. the <warning> element).

If you want your own labels for notes and warnings, specify them using
the label attribute.

Apart from unordered lists, we have ordered lists too, of course.

   1. Item 1
   2. Item 2
     2.1. Item 2.1
   3. This should be 3 if my math is still OK.

Using sections

You can use sections to put some structure in your document. For some
strange historical reason, the section title is an attribute of the
<section> element.

Sections, the sequel

Just some second section.

Section 2.1

Which contains a subsection (2.1).

Showing preformatted source code

Enough about these sections. Let's have a look at more interesting
elements, <source> for instance:

  // This example is from the book _Java in a Nutshell_ by David Flanagan.
           // Written by David Flanagan.  Copyright (c) 1996 O'Reilly &
           // You may study, use, modify, and distribute this example
for any purpose.
           // This example is provided WITHOUT WARRANTY either expressed
or implied.

           import java.applet.*;    // Don't forget these import statements!
           import java.awt.*;

           public class FirstApplet extends Applet {
           // This method displays the applet.
           // The Graphics class is how you do all drawing in Java.
           public void paint(Graphics g) {
           g.drawString("Hello World", 25, 50);

Please take care to still use a sensible line-length within your source

Using tables

And now for a table:
                        Table caption
| heading cell | heading cell | |
| data cell | data cell | |
| Tables can be nested |
   * and can include most other elements, like lists | |

Not much of attributes with <table>, if you ask me.

Using figures

And a <figure> to end all of this. Note that this can also be
implemented with an <img> element.
by Jeff Turner

View raw message