xsl-list
[Top] [All Lists]

access the root element

2005-11-03 08:34:13
I'm desparating.

I have an XML document (very large, 78k lines, generated by the Eclipse
Plugin "Eclipse Metrics") where I want to write an XSL for. The XML is
formed like that:
<?xml version="1.0" encoding="UTF-8"?>
<Metrics scope="eVistaDev" type="PackageRoot" date="2005-11-02"
xmlns="http://metrics.sourceforge.net/2003/Metrics-First-Flat";>
<Cycle>
<Package>A.Package.Name</package>
</Cycle>
<Metric>(further elements)</Metric>
<Metric>(further elements)</Metric>
...
<Metrics>

It is a completely wellformed XML file. I try to access the attributes of
the Metrics element (the root element). I have no luck with that. Can
anybody tell me where is the error for that I'm blind for?

this is the xsl file I have written so far:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="2.0">
    <xsl:output method="html"/>
    <xsl:template match="/">
        <html>
            <head>
                <title>Metrics Report from <xsl:value-of select="@date"
/></title>
            </head>
            <body >
                <H1><xsl:value-of select="@date" />, <xsl:value-of
select="@type" /></H1>
                <h2>Overview for calculated Metrics</h2>
                <!-- 1. Overview over Project -->
                <h3>Overall Metrics</h3>
                <ul>
                <xsl:for-each select="Metric[count(Value)=1]">
                    <li><xsl:value-of select="@id"/> - <xsl:value-of
select="@description"/> : <xsl:value-of select="./Value/@value"/></li>
                </xsl:for-each>
                </ul>
                <!-- 2. Overview over Packages -->
            </body>
        </html>
    </xsl:template>    
</xsl:stylesheet>


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--