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

RE: Output XML to Browser for viewing

Subject: RE: Output XML to Browser for viewing
From: "Ricaud Matthieu" <matthieu.ricaud@xxxxxxx>
Date: Mon, 22 Mar 2004 11:55:17 +0100
xsl output xml
Hello Karl !
I did such a xsl that display any xml file in HTML with clickable tables
color and so on.
You can use it and customize it as you want,
cheers,
Matthieu

The xsl :
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="html" encoding="Windows-1252"/>

	<xsl:template match="/*">
		<html>

		<style type="text/css">
		.FERME {background-color:#BBBBCC; font-family: Verdana; font-size: 8pt;
cursor:pointer;}
		.OUVERT { background-color:#EEF3FB; font-style:blod;font-family: Verdana;
font-size: 8pt; cursor:pointer;}
		.DERNIER { font-style:blod;font-family: Verdana; font-size: 8pt;}
		.VALEURNOEUD { background-color:#FFFFCC; font-family: Verdana; font-size:
8pt;}
		.ATTRIBUT {color:#999999;}
		</style>


		<script language="javascript">
			function affiche_cache(objet){
			ObjetCible=objet.parentNode.nextSibling;
			if (ObjetCible.style.display=="none"){
			    ObjetCible.style.display="block";
			    objet.className="OUVERT";
			      }
			else{
			    ObjetCible.style.display="none";
			    objet.className="FERME";
			    }
			}
		</script>

			<body>
				<table width="100%" align="center" border="1">
					<tr>
						<td width="100%" align="center" class="OUVERT"
onclick="javascript:affiche_cache(this);">
							<xsl:attribute name="colspan"><xsl:value-of
select="count(child::*)"/></xsl:attribute>
							<b><xsl:value-of select="name()"/></b>
	                				(<span class="ATTRIBUT"><xsl:for-each
select="@*"><b><xsl:value-of select="name()"/></b> : <i><xsl:value-of
select="."/></i>&#160;&#160;</xsl:for-each></span>)
                  				</td>
					</tr>
					<tr>
						<xsl:apply-templates select="*"/>
					</tr>
				</table>
			</body>
		</html>
	</xsl:template>


	<xsl:template match="*">
		<td valign="top" bgcolor="white">
			<xsl:choose>

				<xsl:when test="*">
					<table width="100%" align="center" border="1">
						<tr>
							<td width="100%" align="center" class="FERME"
onclick="javascript:affiche_cache(this);">
								<xsl:attribute name="colspan"><xsl:value-of
select="count(child::*)"/></xsl:attribute>
								<b>	<xsl:value-of select="name()"/></b>
								 (<span class="ATTRIBUT"><xsl:for-each select="@*"><b><xsl:value-of
select="name()"/></b> : <i><xsl:value-of
select="."/></i>&#160;&#160;</xsl:for-each></span>)
							 </td>
						</tr>
						<tr style="display:none">
							<xsl:apply-templates select="*"/>
						</tr>
					</table>
				</xsl:when>

				<xsl:otherwise>
					<div class="DERNIER">
					<b><xsl:value-of select="name()"/></b>
					 (<span class="ATTRIBUT"><xsl:for-each select="@*"><b><xsl:value-of
select="name()"/></b> : <i><xsl:value-of
select="."/></i>&#160;</xsl:for-each></span>)
					 </div>
					 <div class="VALEURNOEUD"><xsl:value-of select="."/></div>
         			</xsl:otherwise>

			</xsl:choose>
		</td>
	</xsl:template>
</xsl:stylesheet>

-----Message d'origine-----
De : owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]De la part de Karl J.
Stubsjoen
Envoyi : samedi 20 mars 2004 18:13
@ : xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Objet :  Output XML to Browser for viewing


Hi There,

I'm interested in outputing XML to the browser as HTML for viewing.  I would
like to create indents, give color to nodes and attributes, and so on.  If
I'm getting real fancy, I would be interested in creating collapsible nodes,
but not a requirement up front.
I know that IE lets you browse an XML document quite nicely, but that is not
what I am after.  I want to kick it out into HTML... if you know what I
mean.

Any advice?

Karl


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


BBCi at http://www.bbc.co.uk/

This e-mail (and any attachments) is confidential and may contain
personal views which are not the views of the BBC unless specifically
stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in
reliance on it and notify the sender immediately. Please note that the
BBC monitors e-mails sent or received.
Further communication will signify your consent to this.

BBCi at http://www.bbc.co.uk/

This e-mail (and any attachments) is confidential and may contain
personal views which are not the views of the BBC unless specifically
stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in
reliance on it and notify the sender immediately. Please note that the
BBC monitors e-mails sent or received.
Further communication will signify your consent to this.

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.