A Sample FAQ DTD and XSL

1. What do you mean with extending here ?

You can add your own DTD and XSL and let xdoc produce the HTML

2. Yes, but I can do this by just using XSLT, so why is this ?

There are several advantages to use xdoc extensibility:

3. How do I get started ?

This FAQ itself is setup as an extention. You can study the main files myfaq.dtd, myfaq2html.xsl and myfaq.bat. The contents of this file are in myfaq.xml (all the <para> etc stuff is reused from text.dtd).

These are the main steps:

  1. Write a DTD for your document. In your DTD you may reuse text.dtd (see faq.dtd) but you're not obliged.
  2. Write an XSLT stylesheet for your DTD. The convention is that the name is <mydtd>2html.xsl e.g. faq2html.xsl. If you use text.dtd you may want to include text2html.xsl in your XSL file (see e.g. faq2html.xsl).
  3. Test by writing documents according to your DTD. The convention is that the DTD name after <!DOCTYPE is <mydtd> e.g. "myfaq"
  4. xdoc searches DTDs and XSL files according to the CLASSPATH. So you may need to adapt the xdoc.bat (.sh) script to put your directory in first. (see myfaq.bat)
  5. Test the conversion by calling xdoc on your XML documents. The result here is in myfaq.html.

4. What else can I extend ?

Offcourse you can always modify the existing DTDs and XSL files and overrule the ones in xbook.jar by putting them in your CLASSPATH first.

5. I think this is cool.

Thanks.