Sent: Monday, October 16, 2000 6:44
PM
Subject: Re: displaying xml
Hi Troy, thanks, but I've already tried. the
<pre> </pre> tags do preserve the indentation of the XML, but
do not allow for the displaying of tags for some
reason.
1) use <xmp> </xmp> tags - pre
can;'t help.
2) use this xsl for XML parsing - ( i use it
with Salaman's Saxon XSLT engine, but it will work under Orion default XSLT
(xerces))
it will display your XML as HTML with XML
reformating and coloring
<!-- Generic stylesheet for viewing
XML -->
<!-- This stylesheet has been modified to use modes instead
of nested templates. -->
<!-- Last Updated by Parf: moved to lotus
xsl, main tag fix -->
<xsl:template
match="/">
<HTML>
<xsl:apply-templates/>
</HTML>
</xsl:template>
<xsl:template
match="node()">
<xsl:if
test="name()!='xml-stylesheet'">
<b><big><xsl:text><</xsl:text><xsl:value-of
select="name()"/><xsl:text>></xsl:text></big></b><br/>
<DIV STYLE="font-family:Courier; font-size:10pt;
margin-bottom:0em">
<xsl:apply-templates mode="inside"/>
</DIV>
<b><big><xsl:text></</xsl:text><xsl:value-of
select="name()"/><xsl:text>></xsl:text></big></b>
</xsl:if>
</xsl:template>
<xsl:template match="*"
mode="inside">
<DIV
STYLE="margin-left:1em">
<SPAN
STYLE="color:blue">
<xsl:text><</xsl:text>
<b><xsl:value-of
select="name()"/></b>
<xsl:for-each
select="@*">
<xsl:call-template
name="attribute"/>
</xsl:for-each>
<xsl:choose>
<xsl:when
test="self::node()">
<xsl:text>></xsl:text>
<xsl:apply-templates
mode="inside"/>
<xsl:text></</xsl:text>
<xsl:value-of
select="name()"/>
<xsl:text>></xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>/></xsl:text>
</xsl:otherwise>
</xsl:choose>
</SPAN>
</DIV>
</xsl:template>
<xsl:template
name="attribute">
<SPAN
STYLE="color:navy">
<xsl:text>
</xsl:text>
<xsl:value-of select="name()"/>
<xsl:text>="</xsl:text>
<SPAN
STYLE="color:black">
<xsl:value-of select="."/>
</SPAN>
<xsl:text>"</xsl:text>
</SPAN>
</xsl:template>
<xsl:template
match="comment()" mode="inside">
<SPAN
STYLE="color:orange">
<xsl:text><!--</xsl:text><xsl:value-of
select="."/><xsl:text>--></xsl:text>
</SPAN>
</xsl:template>
<xsl:template
match="processing-instruction()" mode="inside">
<DIV STYLE="margin-left:1em;
color:maroon">
<xsl:text><?</xsl:text>
<xsl:value-of select="name"/>
<xsl:text> </xsl:text>
<xsl:value-of select="."/>
<xsl:text>?></xsl:text>
</DIV>
</xsl:template>
<xsl:template match="text()"
mode="inside">
<SPAN
STYLE="color:green">
<xsl:value-of
select="."/>
</SPAN>
</xsl:template>
</xsl:stylesheet>