RE: [xsl] Dsiplayig xml in tables

Subject: RE: [xsl] Dsiplayig xml in tables
From: Phillip Nicolson <pjn3@xxxxxxxxxxxxx>
Date: 10 Mar 2004 10:47:28 +0000
Ricaud,

many thanks - that gives me something to work from! And it also appears
to work fine in Mozilla.

thanks again

On Wed, 2004-03-10 at 11:26, Ricaud Matthieu wrote:
> Hi !
> 
> I had written a stylesheet that display any xml file in table (clicking on a case display the childrens), maybe it can help you.
> (It works fine on IE, i did not test other browsers...)
> 
> So this is it : 
> 
> <?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>
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
-- 
Phillip Nicolson			
Department of Physics & Astronomy		Phone:	(0)116 2523581
University of Leicester				Email:	pjn3@xxxxxxxxxxxxx
Leicester        LE1 7RH			Web:	http://www.astrogrid.org


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


Current Thread