Re: Serving generic XML (was: storing info in XSL-FO: new issue?)

[leaving www-style in, because (a) I don't read www-talk and (b) my 
reply moves things back towards being on-topic for that group (in that 
it is primarily concerned with stylesheets as a way to approach the issue)]

Etan Wexler wrote:
> 
> As Håkon has written, it's a question of stepping in the right
> direction, moving from formats that are inaccessible to formats that are
> more accessible.  From this perspective, XML of unknown document type has
> its place.

I'm going to repost this here because the subthread in which I initially 
replied had an inflammatory subject line (WAI: threat or menace?) that 
may have discouraged people from even looking at posts in it. I 
encourage people to go back and look at the parent from which I'm 
quoting, too: it was among the more intelligent and thorough posts made 
on this topic so far. But my own comment was (starting with a quote):

Kynn Bartlett wrote:
 >
 > 2.  Another idea might be to require that XML documents be sent
 >     with an appropriate style sheet if the XML is intended for
 >     display to users (and not merely computer-to-computer
 >     communication).
 >
 > 3.  Here's yet another idea -- develop some sort of meta-language
 >     which can be used to assign meaning to particular elements in
 >     arbitrary XML, thereby telling the user agent what the language
 >     means.

Seems to me that by combining these two ideas, the problem can be solved 
*today* (at least if you're willing to disregard all but the very newest 
browsers - in the near-ish future, at least, if you aren't).

My thought is that the best way to "assign meaning to particular 
elements in arbitrary XML" is to use XSLT to transform those elements to 
another language which already carries such meaning. Such as (gasp) XHTML!

In other words, send generic XML by all means, and put as much 
(domain-specific and therefore unknowable to the browser) semantic 
content in it as possible. But accompany it with an XSLT stylesheet that 
transforms it into XHTML using XHTML's slightly lower-level semantics.

For example, your XSLT could transform this:

<singer>
   <name>Madonna</name>
   <album name="Ray Of Light">
     <song name="Ray Of Light" released="true">
       <release date="2001-xx-xx" />
       <lyrics>
         <verse>...</verse>
         <chorus>...</chorus>
       </lyrics>
     </song>
   </album>
</singer>

Into this:

<h1 class="singer">Madonna</h1>
<h2 class="album">Ray of Light</h2>
<h3 class="song">Ray of Light</h3>
<p class="released-on">Released on <span class="date">xx Xxxxx 
2001</span></p>
<h4 class="subhead">Lyrics</h4>
<blockquote class="verse">...</blockquote>
<blockquote class="chorus">...</blockquote>

(along with the <html><head>... stuff of course).

Now the higher-level semantics "this is a singer" are not lost, and a 
smart client (eg an MP3 player?) can read the original XML directly. But 
a "dumb" client like a web browser still gets access to the lower-level 
semantics "this is a headline, this is a lower-level headline, this is a 
longish quoted section of something". Further, the XHTML can include its 
own CSS stylesheet to indicate a suggested rendition for traditional 
graphical browsers, without compromising the capability of 
accessibility-browsers to ignore the stylesheet and render headings in a 
way that's useful for that specific device. If the author is 
particularly interested in certain accessibility markets, CSS 
stylesheets for aural and/or braille representation can also be 
included, but these aren't necessary because the aural or braille 
browser has default stylesheets for XHTML that will do the job (contrast 
to the "require all arbitrary XML to be sent with a CSS stylesheet" 
position, where all arbitrary XML must include stylesheets for *all* 
media if it is to be accessible).

In the future, it's possible that XML vocabularies with higher levels of 
well-understood semantics will become widely distributed, so that you 
can say "this is a credit card number, this is a date, this is a name" 
etc. When that happens, the same trick can be used - use XSLT to 
transform from the domain-specific semantics to the lower-level 
publically-understood semantics. And for legacy browsers, XSLT can also 
further translate these down to the still-lower level of semantics 
implicit in XHTML.

Stuart.

-- 
Stuart Ballard, Programmer
NetReach - Internet Solutions
(215) 283-2300, ext. 126
http://www.netreach.com/

Received on Friday, 23 August 2002 16:07:05 UTC