[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: Displaying XML source with XSL


Subject: RE: Displaying XML source with XSL
From: "alan dennis" <alan_l_dennis@xxxxxxxxxxx>
Date: Fri, 08 Jan 1999 13:10:45 PST



----Original Message Follows----
From: "Markor, John (Non-HP)" <jmarkor@xxxxxxxxxx>
To: "'xsl-list@xxxxxxxxxxxxxxxx'" <xsl-list@xxxxxxxxxxxxxxxx>
Subject: RE: Displaying XML source with XSL
Date: Fri, 8 Jan 1999 07:17:01 -0800
Reply-To: xsl-list@xxxxxxxxxxxxxxxx

Actually, IE5b2 does something similar to this, with direct viewing of 
the
XML file.  The program even allows for expansion and collapse of the XML
file, based on the mark-up.

-----Original Message-----
From: Zvi Schreiber [mailto:zvi@xxxxxxxxxxx]
Sent: Thursday, January 07, 1999 9:31 PM
To: XSL mailing list
Subject: Displaying XML source with XSL


Does anyone please have an XSL script which simply reproduces the 
original
XML for displaying in a browser, i.e. produces HTML which displays the
original XML preferably indented?

Thanks

Zvi Schreiber


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
<?xml version="1.0"?>

<!-- Generic stylesheet for viewing XML -->
<xsl:template xmlns:xsl="http://www.w3.org/TR/WD-xsl">

  <DIV STYLE="font-family:Courier; font-size:10pt; margin-bottom:2em">
    <xsl:apply-templates select="."/>
  </DIV>
  
  <xsl:templates>
    <xsl:template><xsl:apply-templates/></xsl:template>

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

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

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

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

    <xsl:template match="cdata()"><pre>&lt;![CDATA[<xsl:get-value />]]&gt;</pre></xsl:template>

    <xsl:template match="textnode()"><xsl:get-value /></xsl:template>
  </xsl:templates>
</xsl:template>

Current Thread
Keywords