The XSLT conversion scheme

XSLT conversion scheme

As you can see the only input source for XSLT is XML. XSLT does a downtranslate on the XML source.

The output result can be:

  • XML
  • html
  • text

A downtranslate parses data into another form, this output data may contain markup. To be able to do this downtranslate the input data (XML) goes to a parser.

The parser is a peace of software used by the XSLT processor that checks the syntax of the input data and builds a data structure.

Most of the XSLT processors use the DOM model (document object model) which means the result of this parsing is a tree built in memory. This tree is then in a second step transformed with XSLT to the output result.

Because the tree is kept in memory you can randomly access and traverse the tree.

The OmniMark conversion scheme

OmniMark conversion scheme

Now let’s look at the OmniMark conversion scheme. OmniMark can do the same downtranslate as XSLT but it can do a lot more:

  • uptranslate
  • context translate
  • crosstranslate

The input source can be XML, but it’s not required, it can be whatever structured data.

The OmniMark downtranslate

Next to XML, OmniMark can use SGML for a downtranslate.

OmniMark doesn’t build the whole tree of the input in memory instead it uses the streaming model like SAX. This means the input data flows from top to bottom and events are fired when features are encountered.

The big advantage of this model is that a stream can be endless. It’s like water flowing through a pipe. It can not blow up the computers memory if the input XML is huge.

The critical reader will however say, the streaming model looks attractive but:

  • What if I want to build a toc at the beginning of my XML document?
  • What if I want to use cross references?
  • Or in generally, what if I have to output something at this point in the stream that has not been flowed through the pipe yet?

OmniMark has a solution for this which is named referents. I’ll show in a future post how this works.

The OmniMark uptranslate

When doing a downtranslate the input data goes directly to the parser, with an uptranslate however you add markup to the data. This is done using find rules (something like find/replace what I’ll demonstrate in a future post). The output is also sent to the parser which will raise errors if the markup isn’t correct.

The OmniMark context translate

A context translate is a combination of uptranslate and downtranslate. It’s used to transform data from one format to an other with XML as intermediate format. This can be handy for non XML complex conversions, where XML is used as the intermediate format, checked by the parser.

The OmniMark crosstranslate

When using a crosstranslate the parser is not involved. The input data goes to the find rules.

Conclusion

As you can see by these schemes, the OmniMark capabilities are a superset of XSLT.

In future posts I’ll give for each translate type a real example.

Rating 2.00 out of 5
[?]