Part A - Generic parse.allXML function

Subject: Part A - Generic parse.allXML function
From: David RR Webber <Gnosis_@xxxxxxxxxxxxxx>
Date: Sat, 8 May 1999 12:19:49 -0400
Below is the XSL for (almost) parsing any incoming XML
and displaying it indented and highlighted.

The script stopped working in the final release of IE5.0
becuase the nodename and attribute functions it was using

I hacked at it to at least get something running - giving my
time / knowledge constraints and what I could find syntax wise
at Microsofts web site.

Does anyone have a better version of the below???

Would great appreciate same.

Thanks, DW.
<!-- Generic stylesheet for viewing XML -->

<xsl:stylesheet xmlns:xsl="";>




    <xsl:template match="*">
      <DIV STYLE="margin-left:1em; color:red">
        &lt;<xsl:apply-templates for="@*"/>/&gt;

    <xsl:template match="*[node()]">
      <DIV STYLE="margin-left:1em">
        <SPAN STYLE="color:blue">&lt;
            <xsl:apply-templates select="@*"/>
            <xsl:apply-templates select="node()"/>
        <SPAN STYLE="color:green">&lt;/<xsl:attribute />

    <xsl:template match="@*">
      <SPAN STYLE="color:navy"> ="<SPAN STYLE="color:black"></SPAN>"</SPAN>

    <xsl:template match="pi()">
      <DIV STYLE="margin-left:1em; color:maroon">&lt;
        <xsl:apply-templates select="@*"/>


    <xsl:template match="textnode()">

<xsl:template match="/">
  <HTML><TITLE>XML via XSL sample</TITLE>
   <H1 STYLE="Font-family: Arial; color: blue">
    <img src="xmledi.gif" align="middle"/>
    XML via XSL sample


 XSL-List info and archive:

Current Thread