[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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
generic parse
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
disappeared!!?

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="http://www.w3.org/TR/WD-xsl">

<xsl:script>


</xsl:script>

  <xsl:template><xsl:apply-templates/></xsl:template>

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

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

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

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

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

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


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


</xsl:stylesheet>


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.