Page 1 of 1

Using a DTD as a template

Posted: Mon Jul 07, 2003 2:02 pm
by petef
I want to write a Simplified DocBook article. I have the the dtd (http://www.oasis-open.org/docbook/xml/s ... ocbook.dtd) but I can't seem to get Oxygen to use it as a template for a new xml document. I've tried various things including dropping it in the docbook folder and restarting (which did nothing) and using the Add to templates menu option which meant that my new empty document was just a copy of the DTD rather than conforming to it. I'm guessing that a simple entry in my templates.xml file will do the trick but I can't find anything in the help about what format this should take.

Please help.

Posted: Tue Jul 08, 2003 8:29 am
by george
Hi,

If you have a DTD and you want to create a document based on that you can follow the steps below:
  • Go to File and select New
  • Select XML Document and click Ok
  • Click on the DTD tab
  • Press enter - the root element combo will be filled with possible root elements for your document
  • Choose article
  • Press Ok
Now you will have something like

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article SYSTEM
"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
<article>

</article>
Now you can start editing. At any time you can add a document template based on your document. For instance if you edit the document to contain

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article SYSTEM
"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
<article>
<title>Article title</title>
<section>
<title>Section 1</title>
<para>Section content</para>
</section>

</article>
and then choose from File menu the Add to templates option and enter My article as the template name for instance, then when you choose New from templates and select the User defined templates you will see My article listed there. The user defined templates are stored in the user home directory under com.oxygenxml/templates.xml. You can publish this file and use the load templates from URL option to access them.

All the best,
George

Thanks

Posted: Wed Jul 09, 2003 11:13 am
by petef
Just what I needed, many thanks.
--
petef