Using XSL to create a report to display both Task and Resource dat

M

Mark D

How do I use XSL to create a report that displays both Task data and Resource
data in a single row? And how do I know what the the 'local-name()' is for
other fields that I may want to include in a report I create?

The following XSL file will display only Task data, but I also want to
include Resource data, like Resource Initials.

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<HTML>
<BODY BGCOLOR="aliceblue">
<DIV><CENTER>

<H2>Unfinished Tasks</H2>
<TABLE BORDER="2">
<TR>
<TH>ID</TH>
<TH>Name</TH>
<TH>Defect</TH>
<TH>% Complete</TH>
<TH>Due</TH>
</TR>

<xsl:for-each select="//*[local-name()='Task']"> <!-- Select all
tasks -->
<xsl:if test="*[local-name()='ID'][.>156]">
<xsl:if test="*[local-name()='ID'][.<194]">
<xsl:if test="*[local-name()='OutlineLevel'][.='4']"> <!--
Select at the Defect level only -->
<xsl:if test="*[local-name()='Milestone'][. = '0']"> <!--
Select all non-milestone rows -->
<xsl:if test="*[local-name()='Summary'][. = '0']"> <!-- Select
all non-summary rows -->
<xsl:if test="*[local-name()='PercentComplete'][. != 100]">
<!-- Select all incomplete tasks -->
<TR>
<TD><xsl:value-of select="*[local-name()='ID']"/></TD>
<TD><xsl:value-of select="*[local-name()='Name']"/></TD>
<TD><xsl:value-of select="*[local-name()='Notes']"/></TD>
<TD><xsl:value-of
select="*[local-name()='PercentComplete']"/></TD>
<TD><xsl:value-of
select="substring(*[local-name()='Finish'],0,11)"/></TD>
</TR>
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:for-each>
</TABLE>
</CENTER></DIV>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
 
M

Mike Glen

Hi Mark,

Try posting on the developer newsgroup. Please see FAQ Item: 24. Project
Newsgroups. FAQs, companion products and other useful Project information
can be seen at this web address: http://project.mvps.org/faqs.htm

Mike Glen
Project MVP



Mark D said:
By the way.... I am using MS Project Professional 2003

Mark D said:
How do I use XSL to create a report that displays both Task data and
Resource
data in a single row? And how do I know what the the 'local-name()' is
for
other fields that I may want to include in a report I create?

The following XSL file will display only Task data, but I also want to
include Resource data, like Resource Initials.

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<HTML>
<BODY BGCOLOR="aliceblue">
<DIV><CENTER>

<H2>Unfinished Tasks</H2>
<TABLE BORDER="2">
<TR>
<TH>ID</TH>
<TH>Name</TH>
<TH>Defect</TH>
<TH>% Complete</TH>
<TH>Due</TH>
</TR>

<xsl:for-each select="//*[local-name()='Task']"> <!-- Select
all
tasks -->
<xsl:if test="*[local-name()='ID'][.>156]">
<xsl:if test="*[local-name()='ID'][.<194]">
<xsl:if test="*[local-name()='OutlineLevel'][.='4']"> <!--
Select at the Defect level only -->
<xsl:if test="*[local-name()='Milestone'][. = '0']"> <!--
Select all non-milestone rows -->
<xsl:if test="*[local-name()='Summary'][. = '0']"> <!--
Select
all non-summary rows -->
<xsl:if test="*[local-name()='PercentComplete'][. !=
100]">
<!-- Select all incomplete tasks -->
<TR>
<TD><xsl:value-of
select="*[local-name()='ID']"/></TD>
<TD><xsl:value-of
select="*[local-name()='Name']"/></TD>
<TD><xsl:value-of
select="*[local-name()='Notes']"/></TD>
<TD><xsl:value-of
select="*[local-name()='PercentComplete']"/></TD>
<TD><xsl:value-of
select="substring(*[local-name()='Finish'],0,11)"/></TD>
</TR>
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:for-each>
</TABLE>
</CENTER></DIV>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top