OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xml-dev] DIDIER'S LAB REPORT



DIDIER'S LAB REPORT
--------------------

To my friends...

After a long period of silence and intense work for a startup, I am back in
my labs for new experiments.

Recently, I burned a bit of glucose for some mental processes about the
notion of transformation. Juggling with the concept, reading my past notes,
discussing with others about the topic, I came to this perspective....

ACTUAL TRANSFORMATION CONCEPT
-----------------------------
The actual concept about XML transformations is that the transformation
process is applied on an XML document. Thus, for instance, an XSLT
stylesheet is applied on an XML document and the result is a new XML
document (or a text/HTML document). The process flow is then:

XML document ----> XSLT stylesheet process -------> new output document

We can say that an XSLT stylesheet is like an interpreter used to process a
particular XML based language. The XML document is the source code and the
XSLT stylesheet is the document containing the interpretation rules.

A DIFFERENT POINT OF VIEW
-------------------------
 Ready? here we go...

I still remind about one of my colleagues telling us that " a different
point of view is worth a thousand point of IQ". I decided to look at XSLT
processing form a different angle...But my IQ is still the same :-)

Let's imagine, for a moment, that we change the document processing order.
That a stylesheet is no longer a document providing a particular
interpretation for a particular language. That a style sheet would be, in
fact, the main document. That a stylesheet would not be applied on an XML
document but that the stylesheet would be _the main_ XML document. That
external fragments would be "pulled" from the outside world and included in
this "singleton" template. Therefore, it would be like going from a pipeline
model (Original doc -> processing -> output) to a "pull" model (template <-
external fragment included in the template).



<html xsl:version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns="http://www.w3.org/TR/xhtml1/strict">
  <head>
    <title>Expense Report Summary</title>
  </head>
  <body>
    <p>Total Amount: <xsl:value-of
select="document('http://www.mysite.com/myfolder')/expense-report/total"/></
p>
  </body>
</html>
We have here a stylesheet reduced to a literal element. In the actual
specifications, a stylesheet may be expressed that way but will need an XML
document as input for the transformation process. But if we reduce a
stylesheet to a single template as illustrated above, this single template
could be the main document and the included information coming from other
XML document/fragment obtained through the document() function. This is the
pull model.

The previous example's output is off course an XHTML document but, in this
case, we didn't got a "bootstrap" XML document on which the stylesheet is
applied. The XSLT template is the bootstrap document. Concretely speaking,
the renderer receives the XSLT document. The renderer process the XSLT
template by "pulling external" content (because of the document() construct)
in the main template.

The main point here is that an XSLT stylesheet with a single template could
be fetched and processed.


Thus, if we let our imagination to be free for a moment, an XML document
like for instance a VoiceXML, XHTML or SVG document could include XSLT
constructs to "pull" content form the external XML world.

Single template XSLT document <------- external content

The value of using a "pull" model for an XSLT document would be that
authoring tools specialized for rendering languages authoring (based on XML)
could easily include XSLT compliant constructs and therefore be used to
build XSLT compliant documents. In fact, this would help to provide to the
customers a "standard" format to replace the plethora of actual template
based systems. Thus, we would have two ways to render documents

a) we start from an XML document used to encode a data model and then we
apply a stylesheet on it. The XML document is then transformed into a
rendering document.
b) we start from an XSLT template (reduced to a single template) and this
latter is processed by an XSLT processor that "pulls" external content to be
included in the XSLT "singleton" template.

cheers
Didier PH Martin