xmlspec-i18n DTD based processing

This document provides a description of how to process documents based on the xmlspec-i18n DTD. The following topics are covered:

Additional information is provided by the Styleguide for i18n specifications and the Notes on use of the xmlspec-i18n dtd.

Where to find the necessary files

The files are in a subdirectory of http://www.w3.org/International/xmlspec/. There is a subdirectory for each version of the DTD. The current version 003 encompasses the following files:

Directory structure for offline editing and testing

  1. Create a set of directories on your machine as follows:

    /International/xmlspec/003/

    Note: The directory 003 may change at some point to 004, and so on. You will be advised of the change and what to do about it at the time.

    Note: for the purposes of this document we will refer to the directory 003 as the xmlspec directory.

  2. Add another set of directories below the International directory that mirror the location of your XML file. For example, for the "my new document" document, there would be a directory tree that looked like:

    /International/mynewdocument/

    Note: for the purposes of this document we will refer to the last of these directories as the xml editing directory.

How to use the xmlspec-i18n.dtd

  1. To work offline put the xmlspec-i18n.dtd and its necessary modules i18n-elements.mod and i18n-extensions.mod into your xmlspec directory.

  2. Using the template, create an XML document myDoc.xml.

  3. At the top of your XML document add a relative path from your XML file to the xmlspec directory. For the ITS requirements document used as an example in the previous section this would be:

    <!DOCTYPE spec SYSTEM "../../xmlspec/003/xmlspec-i18n.dtd">

You should now be able to create an XML document which is compliant to the xmlspec-i18n.dtd. To test your settings, validate your document.

How to produce XHTML files with XSLT

  1. Install the saxon XSLT and XQuery processor in a convient directory, e.g. c:/saxon. Use the latest version (at least 8.4). You can use the open-source implementation which is called "B", e.g. "Saxon-B 8.4". Of course, the commercial implementation, e.g. "Saxon-SA 8.4" works as well.

  2. To run saxon, you need the Java JRE 1.4 or JDK 1.4., or a later version of these products.

  3. Put the files strings.xml, strings.dtd, xmlspec.xsl and xmlspec-i18n.xsl in your xml editing directory, along with any XSLT extensions you may have.

  4. Run the following command from your xml editing directory to process your file myDoc.xml, where PATH2SAXON is the path to your saxon8.jar file, and XMLSPEC is the path to your xmlspec directory:

    java -cp PATH2SAXON/saxon8.jar net.sf.saxon.Transform o- Overview.html myDoc.xml XMLSPEC/xmlspec-i18n.xsl

    Here is an example:

    java -cp "c:/programs/saxon/saxon8.jar" net.sf.saxon.Transform -o Overview.html its-requirements.xml "C:/Program Files/Apache Group/Apache2/htdocs/International/xmlspec/003/xmlspec-i18n.xsl"

    The output of the transformation will be saved in the file Overview.html.

  5. Add a file local.css to your xml editing directory. You can get such a file from Richard or Felix. You don't have to change anything on the XSLT stylesheets, a link to local.css is already in the output document Overview.html.

Changing the CSS Stylesheets for a file

If you want to change apply special styling to your document, consult Richard and Felix first, then make the changes to your local.css file. Don't forget to upload this. You must always test your changes before uploading the HTML file.

Note that you should not depart from the current look and feel without good reasons.

Changing the the XSLT stylesheets

If there is a strong need to change the structure of your HTML document you should ask Richard Ishida or Felix Sasaki to create some XSLT to do this. Note that you should not depart from the current look and feel without good reasons.

Richard and Felix will not change either the xmlspec.xsl or xmlspec-i18n.xsl style sheets. They will create a new stylesheet specific to your type of document that calls xmlspec-i18n.xsl (which calls xmlspec.xsl in turn) and overwrites templates where necessary.

(xmlspec.xsl is just a copy of the original stylesheet for xmlspec documents provided and maintained by Norman Walsh. xmlspec-i18n.xsl calls xmlspec.xsl and provides some additions for documents from the i18n activity of W3C. We keep and maintain xmlspec-i18n.xsl in a central location, to be able to reuse it for many documents and editors.)

Post-processing the XHTML file

Appendix C of the XHTML 1.0 specification recommends that spaces appear before the slash in empty elements to avoid confusing older browsers. The Perl program handleEmptyElements.plx can run through your code just before upload to produce this. You would then use the following command to run this program:

perl "PATH2SCRIPT\handleEmptyElements.plx" Overview.html

An XML declaration will cause Internet Explorer to display the file in Quirks mode, rather than Standards mode. You can automatically remove and replace the declaration by running two Python programs, removedecl.py and adddecl.py before and after you upload the file. You would use the following commands to run these programs:

python "PATH2SCRIPT\removedecl.py" Overview.html

python "PATH2SCRIPT\adddecl.py" Overview.html

See additional scripts.

A template for XML documents based on the xmlspec-i18n.dtd

A template is available to give you a headstart in creating your first xmlspec-based document. Just change whatever is appropriate in this document to create your own.


Richard Ishida, 2005-07-17 16:21

Version: $Id: i18n-docs-processing.html,v 1.1 2008/02/13 12:33:16 fsasaki Exp $