Skip Navigation LinksHome Page > Forums > SpiraTeam Forums > Spira Custom Reports > Simple project membership...
Hi,
For the regulatory purposes I was asked to create a custom report for products to show membership. The report should be in a very simple format:
As no such report is available (my life would be so much easier if Product Membership page had "Print" button!), I had to create it with help of Claude.AI:Standard section: Project Overview
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"> <xsl:template match="/ProjectData/Project"> <div class="Title1"> <xsl:value-of select="Name"/> </div> <p> <xsl:value-of select="Description" disable-output-escaping="yes"/> </p> </xsl:template> </xsl:stylesheet>
Then in Custom section:
Query:
SELECT (US.LAST_NAME + '. ' + US.FIRST_NAME) AS MemberName, PM.PROJECT_ROLE_NAME AS AccessLevel FROM SpiraTestEntities.R_ProjectMembership AS PM INNER JOIN SpiraTestEntities.R_Users AS US ON US.USER_ID = PM.USER_ID WHERE US.IS_ACTIVE = True AND PM.PROJECT_ID = ${ProjectId} ORDER BY US.LAST_NAME, US.FIRST_NAME
And XSLT:
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"> <xsl:template match="/RESULTS"> <table class="DataGrid"> <tr> <th>Member</th> <th>Access Level</th> </tr> <xsl:for-each select="ROW"> <tr> <td><xsl:value-of select="MemberName"/></td> <td><xsl:value-of select="AccessLevel"/></td> </tr> </xsl:for-each> </table> </xsl:template> </xsl:stylesheet>
This produced the report.
Now, if only I could get rid of the report name in the output...
Hello,
Are you referring to the report caption itself or the 'Print Report' hyperlink positioned in the top-left corner of the output page?
Regards,Victoria -
When a report is generated, the name of the report is always inserted into it.
For example, if my report is called "Simple project membership report", the very first line in the resulting document would be
Simple project membership report
Thank you for the additional details - that makes things clear.
So yes, this is completely possible with some simple CSS block, placed right after <xsl:template match="/RESULTS"> and before the table:
<style> .Title1 { display: none; } </style>
Here's the full XSLT with the fix applied:
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"> <xsl:template match="/RESULTS"> <style> .Title1 { display: none; } </style> <table class="DataGrid" style="width:100%"> <tr> ............. </tr> </xsl:for-each> </table>
Thanks for suggestion.
It works for HTML output but not for Word or Excel.
That's correct: it works with HTML only and there's no XSLT-based workaround for this. The report title is added as a document heading before XSLT output is rendered. XSLT only controls the content of each custom section, not the report-level wrapper that includes the title.
I can add an enhancement about having that option to suppress the report name in exports, or allow the XSLT to control whether the title is rendered.
Yes, an option to suppress it would be great!
Thank you
And if you have any questions, please email or call us at +1 (202) 558-6885