This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Dynamic Index?
- To: "'XSL-List at lists dot mulberrytech dot com'" <XSL-List at lists dot mulberrytech dot com>
- Subject: [xsl] Dynamic Index?
- From: "Edlavitch, Ben" <Ben dot Edlavitch at msdw dot com>
- Date: Wed, 7 Mar 2001 13:39:19 -0800
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hello All,
I am trying to create an index.html file that is created by applying
testfile.xml to index.xsl through a cocoon processor. After the index.html
is created there should be a list of links that go to a "details" document.
The "details" document is created by parsing: testfile.xml to an XSLT
Producer called MSDWProducer using a variable $testsuite_name. This
variable $testsuite_name passed to detail.xsl should indicate the node from
the testfile.xml that should be rendered using detail.xsl and the cocoon
processor.
Below I have attemped to write a testfile.xml, index.xsl, and detail.xsl
that produces an index.html file that has the functionality described above.
I am aware that some of my code in incorrect, that is why I am asking for
help.
Thank you,
Ben
####################### testfile.xml ################################
<?xml version="1.0"?>
<?xml-stylesheet href="index.xsl" type="text/xsl"?>
<?cocoon-process type="xslt"?>
<all-junit-reports>
<testsuite name="test.com.msdw.online.aba.MetroBatchLoadTestSuite"
tests="1" failures="1" errors="0" time="2.654 sec">
</testsuite>
<testsuite
name="test.com.msdw.online.controller.financialadvisor.FinancialAdvisorCtrlT
estSuite" tests="1" failures="0" errors="0" time="2.674 sec">
</testsuite>
<testsuite name="test.com.msdw.online.controller.user.UserCtrlTestSuite"
tests="1" failures="1" errors="0" time="2.273 sec">
</testsuite>
####################### index.xsl ################################
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head><title>JUnit Test Cases Report</title></head>
<body>
<H1 class="contentTitle">JUnit Test Cases Report</H1>
<table>
<xsl:for-each select="all-junit-reports/testsuite">
<tr>
<td>
<A>
<xsl:attribute
name="HREF">testfile.xml?producer=MSDWProducer&XSL=detail.xsl&$testsuite_nam
e=<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:value-of select="@name"/>
</A>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
####################### detail.xsl ################################
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:variable name="$testsuite_name"/>
<xsl:template match="/">
<html>
<head><title>Nightly Build</title></head>
<body class="contentFrame" link="black" vlink="red" alink="red">
<table>
<tr>
<td>
<p><font face="helvetica">
<xsl:apply-templates
select="all-junit-reports/testsuite[@name='test.com.msdw.online.aba.MetroBat
chLoadTestSuite']"/>
</font></p>
</td>
</tr>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="all-junit-reports/testsuite[@name='$testsuite_name']">
<H1 class="contentTitle">Nightly Build Reports</H1>
<FIELDSET>
<LEGEND>TEST SUITE INFO:</LEGEND>
<table width="100%">
<tr>
<td>
<font size="2"><b>NAME:</b></font>
</td>
<td>
<font size="2"><xsl:value-of select="@name"/></font></td></tr>
<tr>
<td>
<font size="2"><b>TESTS:</b></font>
</td>
<td>
<font size="2"><xsl:value-of select="@tests"/></font>
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list