Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Tough one
Message
 
To
18/02/2003 17:09:17
Jim Rieck
Quicken Loans/Rock Financial/Title Sourc
Livonia, Michigan, United States
General information
Forum:
ASP.NET
Category:
XML
Title:
Miscellaneous
Thread ID:
00754683
Message ID:
00754769
Views:
15
>All,
>
> I want to create a report using XSLT and XML though I don't know if this is possible or not. The report will be for a project management web app. I want to have a task header displayed and any subtasks or task details below it, and then proceed with the next task header and so on (see sample below). Is there a way to do this if I write the xml file correctly or would it be easier to use a reporting package like Crystal reports? The reason I am looking for a different way to do this is because I have had problems displaying the report.

Yeah, that should be easy enough to do with XML/XSL. Your XML might look like this (I'm sure there are a dozen other ways to do this):
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
<list>
  <topic title="Create home web page">
     <subtopics>
        <description>Add colorful background.</description>
     </subtopics>     
     <subtopics>
        <description>Add login control.</description>
     </subtopics>
  </topic>
  <topic title="Create Guest Book Page">
     <subtopics>
       <description>Add ability for user to do such and such</description>
     </subtopics>
  </topic>
</list>
Then, your XSL would look like:
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns="http://www.w3.org/TR/xhtml1/strict">
<xsl:template match="/">
<html>
<body>
    <TABLE WIDTH="100%">
 
    <xsl:for-each select="list/topic">
      <TR>        
        <TD style="color: #081D84; font-weight: bold; "><xsl:value-of select="@title"/></TD>
      </TR>
    
    <xsl:for-each select="subtopics">        
      <TR>        
        <TD>
          <TABLE>
            <TR>
               <TD><xsl:value-of select="description"/></TD>                      
            </TR>
          </TABLE>
        </TD>
      </TR>
    </xsl:for-each>
    </xsl:for-each>
        
    </TABLE>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
I didn't get fancy with the HTML, but hopefully that helps get you started.
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform