Re: XSL and entities

Subject: Re: XSL and entities
From: James Clark <jjc@xxxxxxxxxx>
Date: Sun, 20 Sep 1998 10:50:16 +0700
G. Ken Holman wrote:

> If you are willing to express the "concepts" (dare I say semantics?) of foo
> in XML, say FooML, and then write a translator from FooML to foo, you would
> be able to then use XSL to do your arbitrary conversions from XML->foo as
> follows:
> 
>   XML ---XSL--> FooML ---FooXlate--> foo
> 
> This does, however, require the FooXlate program to be written, say on top
> of SAX, but written *only once* for all the semantics of whatever makes
> sense for Foo and *without regard* for the transformations necessary from
> other markup languages.

This is the right approach.  To make this work smoothly

- give FooML a namespace URI

- specify that with the result-ns attribute

- use result elements from that namespace (typically by specifying an
xmlns attribute)

- configure your XSL processor with an association between the namespace
URI with the FooXlate program

Then you can translate using XSL to foo and the XSL processor can
automatically give you foo instead of FooML.

Note that FooML doesn't have to be an elaborate expression of the
semantics of Foo in XML (although there advantages if you can do that). 
It can be braindead simple.  For example, for LaTeX a DTD like this
would be probably enough:

<!DOCTYPE LaTeX [
<!ELEMENT LaTeX (#PCDATA|markup)*>
<!ELEMENT markup (#PCDATA)>
]>

The LaTeXXlate program would pass characters within a "markup" element
through unchanged, but would transform characters outside a "markup"
element so that when formatted with LaTeX they would print a
representation of that character.  For example, outside a "markup"
element, { and } would be output as \{ and \}, but inside they would be
output unchanged as { and }.

There are several ways this can be generalized...

James


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread