Subject: RE: [xsl] Nested Disk tree layout From: ed.rolison@xxxxxxxxxxxxxx Date: Tue, 3 Dec 2002 15:53:29 +0000 |
OK, I have largely solved the problem I was trying to, and so, here is the actual xsl template I'm using, along with some (hopefully valid this time, but I've had to snip it to avoid bombing the group with a 26000 line file) sample XML: The XML is being used both to generate this table, and to be used with 'defaultss.xsl' with a few minor tweaks (which I think came from the archives) to default to a collapsed tree, rather than a fully expanded one. The problem being that we bill our customers for disk usage, and this was about the only way we could 'prove' to them how much they were using. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version ="1.0"> <xsl:output method="html"/> <xsl:template match="text()"/> <xsl:template match="/"> <html> <body> <H3>Table of Contents</H3> <TABLE> <xsl:apply-templates select="ALL/BYDIRECTORY" mode="toc"/> </TABLE> </body> </html> </xsl:template> <xsl:template match="L0|L1|L2|L3|L4|L5|L6|L7" mode="toc"> <TR> <xsl:call-template name="format_table"> <xsl:with-param name="count"> <xsl:number value="count(ancestor::*)-2" /> </xsl:with-param> </xsl:call-template> <TD> <xsl:value-of select="DIR"/> </TD> <xsl:if test="not ( string-length(@DIR) = 0 )"> <TD> <xsl:value-of select="SIZE"/> </TD> </xsl:if> </TR> <xsl:apply-templates select="L0|L1|L2|L3|L4|L5|L6|L7" mode="toc"/> </xsl:template> <xsl:template name="format_table"> <xsl:param name="count" select="0" /> <xsl:choose> <xsl:when test="$count > 0"> <TD></TD> <xsl:call-template name="format_table"> <xsl:with-param name="count" select="number($count)-1" /> </xsl:call-template> </xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet> And the data <?xml version="1.0" encoding="ISO8859-1" ?> <?xml-stylesheet type="text/xsl" href="/dusage/TOC.xsl"?> <ALL> <TITLE>Disk usage report for fs003 </TITLE> <DATE>28/11/02</DATE> <BYDIRECTORY> <TITLE>Listing by Directory</TITLE> <L0 DIR="" SIZE="145.07Gb" DEPTH="0"> <SIZE>145.07Gb</SIZE> <DIR></DIR> <FULL_PATH></FULL_PATH> <L1 DIR="/fs003" SIZE="145.07Gb" DEPTH="1"> <SIZE>145.07Gb</SIZE> <DIR>/fs003</DIR> <FULL_PATH>/fs003</FULL_PATH> <L2 DIR="/technology" SIZE="145.07Gb" DEPTH="2"> <SIZE>145.07Gb</SIZE> <DIR>/technology</DIR> <FULL_PATH>/fs003/technology</FULL_PATH> <L3 DIR="/S-Seg" SIZE="10.93Gb" DEPTH="3"> <SIZE>10.93Gb</SIZE> <DIR>/S-Seg</DIR> <FULL_PATH>/fs003/technology/S-Seg</FULL_PATH> <L4 DIR="/Departmental-shares" SIZE="10.93Gb" DEPTH="4"> <SIZE>10.93Gb</SIZE> <DIR>/Departmental-shares</DIR> <FULL_PATH>/fs003/technology/S-Seg/Departmental-shares</FULL_PATH> <L5 DIR="/laa" SIZE="10.93Gb" DEPTH="5"> <SIZE>10.93Gb</SIZE> <DIR>/laa</DIR> <FULL_PATH>/fs003/technology/S-Seg/Departmental-shares/laa</FULL_PATH> <L6 DIR="/laa-gen" SIZE="10.93Gb" DEPTH="6"> <SIZE>10.93Gb</SIZE> <DIR>/laa-gen</DIR> <FULL_PATH>/fs003/technology/S-Seg/Departmental-shares/laa/laa-gen</FULL_PATH> <L7 DIR="/ADEs" SIZE="9.10Mb" DEPTH="7"> <SIZE>9.10Mb</SIZE> <DIR>/ADEs</DIR> <FULL_PATH>/fs003/technology/S-Seg/Departmental-shares/laa/laa-gen/ADEs</FULL_PATH> </L7> <L7 DIR="/Aero_info" SIZE="17.05Mb" DEPTH="7"> <SIZE>17.05Mb</SIZE> <DIR>/Aero_info</DIR> <FULL_PATH>/fs003/technology/S-Seg/Departmental-shares/laa/laa-gen/Aero_info</FULL_PATH> </L7> <L7 DIR="/Departmental_Info" SIZE="612.77Mb" DEPTH="7"> <SIZE>612.77Mb</SIZE> <DIR>/Departmental_Info</DIR> <FULL_PATH>/fs003/technology/S-Seg/Departmental-shares/laa/laa-gen/Departmental_Info</FULL_PATH> </L7> <L7 DIR="/From%20CAD2" SIZE="109.94Mb" DEPTH="7"> <SIZE>109.94Mb</SIZE> <DIR>/From%20CAD2</DIR> <FULL_PATH>/fs003/technology/S-Seg/Departmental-shares/laa/laa-gen/From%20CAD2</FULL_PATH> </L7> <L7 DIR="/TA%20Notes" SIZE="68.25Mb" DEPTH="7"> <SIZE>68.25Mb</SIZE> <DIR>/TA%20Notes</DIR> <FULL_PATH>/fs003/technology/S-Seg/Departmental-shares/laa/laa-gen/TA%20Notes</FULL_PATH> </L7> <L7 DIR="/Users" SIZE="10.01Gb" DEPTH="7"> <SIZE>10.01Gb</SIZE> <DIR>/Users</DIR> <FULL_PATH>/fs003/technology/S-Seg/Departmental-shares/laa/laa-gen/Users</FULL_PATH> </L7> <L7 DIR="/VT41B" SIZE="25.53Mb" DEPTH="7"> <SIZE>25.53Mb</SIZE> <DIR>/VT41B</DIR> <FULL_PATH>/fs003/technology/S-Seg/Departmental-shares/laa/laa-gen/VT41B</FULL_PATH> </L7> <L7 DIR="/data" SIZE="81.74Mb" DEPTH="7"> <SIZE>81.74Mb</SIZE> <DIR>/data</DIR> <FULL_PATH>/fs003/technology/S-Seg/Departmental-shares/laa/laa-gen/data</FULL_PATH> </L7> </L6> </L5> </L4> </L3> </L2> </L1> </L0> </BYDIRECTORY> </ALL> CONFIDENTIALITY: This e-mail and any attachments are confidential and may be privileged. If you are not a named recipient, please notify the sender immediately and do not disclose the contents to another person, use it for any purpose, or store or copy the information in any medium. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Nested Disk tree layout, Cross, Neal - Develo | Thread | [xsl] special character, Sachdeva, Rajeev |
[xsl] Reusable XSLT templates, Cams Ismael | Date | RE: [xsl] Reusable XSLT templates, Ben Robb |
Month |