spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / xml / column4

The Browser War continued: XML support in IE and Mozilla

Web Designers with Mad Skills!
Aquent
US-CA-Los Angeles

Justtechjobs.com Post A Job | Post A Resume
Developer News
Google Chrome Playing Catch-Up on Extensions
Open Solutions Alliance Gets New Leadership
Red Hat Spacewalk Expands Linux Management

The XSL solution for Internet Explorer

Another possibility to make the links active in IE is to use an XSLT style sheet in order to transform arbitrary XML tags into HTML anchors:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" 
  xmlns:xll="http://www.w3.org/XML/XLink/0.9" 
  xmlns:html="http://www.w3.org/TR/REC-html40">
   <xsl:template match="/">
      <HTML>
         <HEAD>
            <TITLE>Books</TITLE>
         </HEAD>
         <BODY>
            <xsl:apply-templates/>
         </BODY>
      </HTML>
   </xsl:template>
   <xsl:template match="Books">
     <xsl:apply-templates/>
   </xsl:template>
   <xsl:template match="Book">
     <P>
       <xsl:apply-templates/> 
     </P>
   </xsl:template>
   <xsl:template match="BookCover">
       <xsl:apply-templates/> 
   </xsl:template>
   <xsl:template match="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:template match="text()">
     <xsl:value-of select="."/>
   </xsl:template>
</xsl:stylesheet>
When you have read the earlier article on XSL you should have no problem understanding this style sheet. See the result in HTML. Since Microsoft's implementation in IE5 is based on the working draft version 0.9, some things can be improved by using version 1.0 recommendation features described on the next page.

next page

http://www.internet.com

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Review: Lenovo ThinkPad SL300 · OCZ PC3-10666 Gold 2x1GB Review · Apple Recommends Antivirus for Macs


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

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