Re: XT and HTML conversion

Subject: Re: XT and HTML conversion
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 27 Feb 1999 13:35:01 -0500
At 99/02/27 09:52 -0500, Simon St.Laurent wrote:
>>XT converts XML to XML.  However, it can change how it serializes the
>>result based on the result-ns attribute.  If the result-ns identifies
>>the result as HTML 4.0, which XT knows uses SGML syntax, proper syntax
>>is used.  If you don't use the result-ns attribute, I don't believe XT
>>will attempt to guess the intended syntax (IOW, XML syntax will be
>>used for the serialization).
>
>I'm confused as well.  I thought XSL was supposed to produce strictly XML
>syntax, after the battles I'd been following on this list.  This argument
>had been used on a number of folks who wanted to create documents that
>followed HTML conventions that didn't correspond with XML.  Now XT can
>produce 'proper syntax', whatever that 'proper syntax' may be, even if it's
>isn't XML?
>
>It looks like I'll be spending the morning exploring the spec again.
>Anyone have a good simple explanation of these issues?

If I may try to summarize ... I'm not on the committee, but this is my
understanding and how I have presented it to my students.

The XSL data model describes nodes and trees of nodes.  An XSL engine uses
a stylesheet tree of nodes (created from an XML instance) to direct the
creation of a result tree of nodes using, where desired, information from a
source tree of nodes (created from an XML instance).

Instructions in the stylesheet node tree are those nodes whose elements
come from the namespace "http://www.w3.org/TR/WD-xsl";.  Other nodes found
in the stylesheet node tree from any other namespace are candidates to end
up in the result tree of nodes.

The stylesheet writer instructs the XSL engine what to do with the result
node tree through the optional use of the result-ns= attribute to specify
the result namespace.  If specified as a prefix whose namespace is
"http://www.w3.org/TR/WD-xsl/FO";, then the normative behaviour is to
interpret the result node tree according to the semantics of the vocabulary
of formatting objects as described in the recommendation.

I'm not familiar enough with W3C conventions to know if a note in a
recommendation is considered normative or informative (could someone help
me here? the language of note uses "should" so I'm assuming it is
informative), but a note in XSL states that the convention of specifying
"http://www.w3.org/TR/REC-html40"; as the result namespace is a signal to
the XSL engine that the result node tree be emitted following the syntax
conventions of HTML 4.0.  XSL engines wishing to interpret other
vocabularies or to implement other syntax conventions for the result node
tree are instructed by the stylesheet to use those conventions through the
use of the result namespace.

Otherwise, the normative behaviour is to emit the result node tree using
XML syntax conventions.

Therefore, to get XML'ized HTML one mustn't specify
"http://www.w3.org/TR/REC-html40"; or "http://www.w3.org/TR/WD-xsl/FO"; as
the result namespace.

To specify the result node tree is the vocabulary of formatting objects,
using the conventional (not normative) prefix of "fo" and the normative URL
of "http://www.w3.org/TR/WD-xsl/FO";, use:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";
                xmlns:fo="http://www.w3.org/TR/WD-xsl/FO";
                result-ns="fo">

To specify the result node tree is using the HTML 4.0 vocabulary, thus
emitting the tree using HTML 4.0 syntax conventions use:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";
                xmlns="http://www.w3.org/TR/REC-html40";
                result-ns="">

To emit the result node tree using XML syntax conventions:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";>

Is the above a *good* explanation?  I can't judge ... it is longwinded
because I wanted to be precise, but I think the above is simple to
understand and my students haven't questioned it.

I've illustrated this in the lecture notes for my course ... a 30-slide
summary of the 163 slides is available for free download in the Training
Materials section of my website.  The diagram is on the slide numbered 60.
Note that the one set of slides covers the entire course, titled
"Introduction to XSL" for the 1 day lecture and also titled "Practical
Formatting Using XSL" for the 2-day hands-on workshop.  The material is the
same, the workshop includes additional hands-on samples and exercises
designed to re-inforce the concepts.

I hope this helps.

...... Ken





--
G. Ken Holman                  mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.           http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0  +1(613)489-0999  (Fax:-0995)
Website: XSL/XML/DSSSL/SGML services outline,  XSL/DSSSL shareware, 
         stylesheet resource library, conference training schedule, 
         commercial stylesheet training materials, on-line XSL CBT.
Next instructor-led XSL Training: X-Tech:1999-03-07 WWW8:1999-05-11


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


Current Thread