ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xsl-list
xsl-list
[xsl] invoking nodes from multiple XML files
by Chun Ji other posts by this author
Nov 28 2006 2:09PM messages near this date
[xsl] XML design for XSLT (was Re: [xsl] Standards checkers for XSLT) | [xsl] Simulate schema-awareness to create comboBoxes
& XSLT 
I have 10 XML files, test1.xml, test2.xml, ...
test10.xml. Each contains the results of my
test-cases. 

This is test1.xml looks like:  
" 
<?xml version="1.0" encoding="ISO-8859-1" ?> 
<?xml-stylesheet href="test.xsl" type="text/xsl"?> 
<suites> 
     <suite thread-count="5" verbose="2"
name="billing" parallel="null" annotations="JDK5"> 
             <test
name="test.domain.billing.MspBillingConfigTest"
junit="true"> 
                   <completed> OK</completed>
                    <total> 4</total>
                    <passed> 4</passed>
                    <failed> 0</failed>
                    <skipped> 0</skipped>
            </test> 
            <test
name="test.domain.billing.MealExpenseTest"
junit="true"> 
                   <completed> OK</completed>
                   <total> 4</total>
                   <passed> 3</passed>
                   <failed> 1</failed>
                   <skipped> 0</skipped>
           </test> 
           ....
     <suite> 
<suites> 
". 

The name of each test node is unique, of all these 10
XML files. And I have created a "test.xsl" file, which
can display each individual XML file in html format. 

here is my "test.xsl" file  
" 
<?xml version="1.0" encoding="ISO-8859-1"?> 
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
version="1.0"> 

<xsl:template match="/"> 
  <html> 
  <body> 
    <table boarder="2" width="60%"> 
       <tr> 
        <td align="left" > <font size="5"><strong>Test
Results.</strong> </font>(testlog.html)
          <xsl:element name="a"> 
                <xsl:attribute
name="href"> testlog.html</xsl:attribute>
                <xsl:attribute
name="target"> classFrame</xsl:attribute>
          </xsl:element> 
        </td> 
      </tr> 
    </table> 
    <table boarder="2"> 
      <tr> 
        <th bgcolor="#ccccff" align="center"> TEST</th>
        <th bgcolor="#ccccff"
align="center"> Completed</th>
        <th bgcolor="#ccccff"
align="center"> TOTAL</th>
        <th bgcolor="#ccccff"
align="center"> Passed</th>
        <th bgcolor="#ccccff"
align="center"> Failed</th>
        <th bgcolor="#ccccff"
align="center"> Skipped</th>
      </tr> 
      <xsl:for-each select="suites/suite/test"> 
         <xsl:sort select="@name"/> 
      <tr> 
        <td  align="left" bgcolor="#BFC1CC"> 
         <b> 
           <xsl:element name="a"> 
             <xsl:attribute name="href"> <xsl:value-of
select="/suites/suite/@name"/> /<xsl:value-of
select="@name"/> .html</xsl:attribute>
             <xsl:attribute
name="target"> classFrame</xsl:attribute>
             <xsl:value-of select="@name"/> 
           </xsl:element> 
           </b> 
           <xsl:if test="name
='test.domain.billing.PurchaseOrderTest'"> 
                (w/ -javaagent)
           </xsl:if> 
        </td> 
        <td  align="center"
bgcolor="#BFC1CC"> <xsl:value-of
select="completed"/> </td>
        <td  align="center"
bgcolor="#BFC1CC"> <xsl:value-of select="total"/></td>
        <td  align="center"
bgcolor="#BFC1CC"> <xsl:value-of select="passed"/></td>
        <xsl:choose> 
          <xsl:when test="failed &gt; 0"> 
              <td  align="center"
bgcolor="FF0000"> <xsl:value-of select="failed"/></td>
          </xsl:when> 
          <xsl:otherwise> 
              <td  align="center"
bgcolor="#BFC1CC"> <xsl:value-of select="failed"/></td>
          </xsl:otherwise> 
        </xsl:choose> 
        <td  align="center"
bgcolor="#BFC1CC"> <xsl:value-of
select="skipped"/> </td>
      </tr> 
     </xsl:for-each> 
    </table> 
  </body> 
  </html> 
</xsl:template> 
</xsl:stylesheet> 
" 

As you can see from the browser, the test results are
listed in a table format

The question I have is how can I merge all the test
results from these 10 XML files and put them in one
html file ? 
 
Thanks for the tips !


cji 



 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

--~------------------------------------------------------------------
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@[...].com> 
--~--
Thread:
Wendell Piez
Chun Ji

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved