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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [ANN] Kludgey workarounds for IE and Netscape

[ Lists Home | Date Index | Thread Index ]
  • From: James Clark <jjc@jclark.com>
  • To: xml-dev@ic.ac.uk
  • Date: Thu, 10 Sep 1998 18:31:43 +0700

Andy Dent wrote:
> 
> At 14:19 +0800 9/9/98, Andrew Bunner wrote:
> >>The transformation part of XSL is intended to produce well-formed XML.
> My perspective may be a little different from others because my initial use
> of XML/XSL is for a report writer which renders to screen/print and only
> secondarily to RTF and HTML.
> 
> The contrast with most of the tools I've looked at (and books I've read) is
> to an XSL community that appear concerned with transforming one set of XML
> to another. To be honest, I keep feeling there's something I've missed here
> - if the transformation is just generating more XML I don't see that
> containing enough information for a renderer.
> 
> Is there anything in the standard which says that, if you are rendering to
> HTML, that you *have* to produce well-formed XML? If you have a server-side
> processor of XML/XSL that is producing HTML I don't see why there's a
> problem. Similarly, an embedded processor in a browser is surely free to
> make its own interpretation.

An XSL processor can do other things with the result tree than just
write it out as XML.

If you want to use XSL to produce some non-XML format, first you need to
devise an XML representation of it.  For example, in the case of HTML,
this would be "well-formed HTML", that is XML using the element types
and attributes of XML.  Now write some code that turns this XML
representation into the real thing.  Now you've just got to arrange for
this code to get run instead of the usual code that writes the result
tree out as XML.  You've got two possibilities. One possibility is to
make this a run-time option for your XSL processor.  Another is to use
the result-ns attribute.  To use this you need to define a namespace for
your HTML representation, make all result elements be from this
namespace, and specify this using result-ns.  Then your XSL processor
can recognize the namespace and do the right thing.  For example,

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

<xsl:template match="/">
  <h:html>
  ...
  </h:html>
</xsl:template>

</xsl:stylesheet>

This gives an XSL processor everything it needs to recognize that you're
generating HTML and do the right thing so you get real HTML.

The XML representation for another format can be very simple.  For
example, if you wanted to generate RTF, you could probably get away with
two element types: one element type for the root, and one element type
to contain RTF control information (outside elements of this type you
would escape {, } and \ as \{, \} and \\}, inside it you would not). 
You might want an element type for \bin too.  

James


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS