The Browser War continued (6/6) - exploring XML | WebReference

The Browser War continued (6/6) - exploring XML

The Browser War continued: XML support in IE and Mozilla

The server-side XSL solution for Opera, Lynx and Emacs

This style sheet is quite similar to the previous, but it is according to the latest XSL recommendation. The URL for the XSL namespace is different, the output method HTML is now supported, and the book cover's image can be matched in one step, saving one level of recursion. The last rule for text can be omitted because it is identical to the default rule:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0" 
  xmlns:xll="http://www.w3.org/XML/XLink/0.9" 
  xmlns:html="http://www.w3.org/TR/REC-html40">
   <xsl:output method="html"/>
   <xsl:template match="/">
      <HTML>
         <HEAD>
            <TITLE>Books</TITLE>
         </HEAD>
         <BODY>
            <xsl:apply-templates/>
         </BODY>
      </HTML>
   </xsl:template>
   <xsl:template match="Book">
      <P>
         <xsl:apply-templates/>
      </P>
   </xsl:template>
   <xsl:template match="BookCover/html:img">
      <xsl:element name="IMG">
         <xsl:attribute name="SRC">
            <xsl:value-of select="@src"/>
         </xsl:attribute>
         <xsl:attribute name="WIDTH">
            <xsl:value-of select="@width"/>
         </xsl:attribute>
         <xsl:attribute name="HEIGHT">
            <xsl:value-of select="@height"/>
         </xsl:attribute>
         <xsl:attribute name="ALT">
            <xsl:value-of select="@alt"/>
         </xsl:attribute>
      </xsl:element><xsl:element name="BR"/>
   </xsl:template>
   <xsl:template match="Title">
      <xsl:element name="A">
         <xsl:attribute name="HREF">
            <xsl:value-of select="@href"/>
         </xsl:attribute><xsl:apply-templates/>
      </xsl:element><xsl:element name="BR"/>
   </xsl:template>
   <xsl:template match="Author">
      <EM>
         <xsl:apply-templates/>
      </EM><xsl:element name="BR"/>
   </xsl:template>
   <xsl:template match="ISBN">
      <FONT FACE="monospace">
         <xsl:apply-templates/>
      </FONT><xsl:element name="BR"/>
   </xsl:template>
   <xsl:template match="Price">
      <FONT COLOR="green">
         <xsl:apply-templates/>
      </FONT><xsl:element name="BR"/>
   </xsl:template>
   <xsl:template match="ListPrice">
   </xsl:template>
   <xsl:template match="Synopsis">
   </xsl:template>
</xsl:stylesheet>
See the result in HTML. I find the differences between the versions quite manageable, but would still prefer Microsoft to deliver a standards-compliant version as soon as possible, with a regular update release and not only some obscure developer-only patch. An improved way of handling XML with CSS 1 and 2 would also be in order.

Conclusion

While both major browsers support XML, this means two very different things apart from the relatively limited CSS styling of XML documents. While Mozilla cannot handle XSL style sheets, Explorer's support of CSS1 for XML and CSS2 is not good enough for rendering the examples on the mozilla.org Web site: The page simply remains blank. So all you cross-browser specialists out there, there is plenty of work awaiting you on the next level of Web Client/Server architecture!

http://www.internet.com


Produced by Michael Claßen
All Rights Reserved. Legal Notices.

URL: http://www.webreference.com/xml/column4/6.html
Created: Jan. 17, 2000
Revised: Jan. 17, 2000