I am new to XSLT. I am trying to use it to generate web based reports. below is a section of the XSLT that is located in a template
Is there way to set up the template so I don't have the create a static header and footer?Code:<table> <thead> <td>New Business</td> </thead> <xsl:apply-templates select="tbl_sp_Test_2_s"> <xsl:with-param name="type" select="'New Business'"/> </xsl:apply-templates> <tfoot> <td>Number of Sales: <xsl:value-of select="count(tbl_sp_Test_2_s[Business = 'New Business']/Company)"/></td> <td class="Amount">New Business Total: <xsl:value-of select="sum(tbl_sp_Test_2_s[Business = 'New Business']/NetRevenue)"/></td> </tfoot> </table> <HR class="SectionBreak"/> <table> <thead> <td>Renewal</td> </thead> <xsl:apply-templates select="tbl_sp_Test_2_s"> <xsl:with-param name="type" select="'Renewal'"/> </xsl:apply-templates> <tfoot> <td>Number of Sales: <xsl:value-of select="count(tbl_sp_Test_2_s[Business = 'Renewal']/Company)"/></td> <td class="Amount">Renewal Total: <xsl:value-of select="sum(tbl_sp_Test_2_s[Business = 'Renewal']/NetRevenue)"/></td> </tfoot> </table> <xsl:template match="tbl_sp_Test_2_s"> <xsl:param name="type"/> <xsl:if test="Business = $type"> <tr> <td><xsl:value-of select="Company"/></td> <td class="Amount"><xsl:value-of select="NetRevenue"/></td> </tr> </xsl:if> </xsl:template>
my XML file look like this
Thank you for your assistanceCode:<Root> <tbl_sp_Test_1_s> <SalesPerson>John Doe</SalesPerson> <tbl_sp_Test_2_s> <Business>[New Business or Renewal]</Business> <Company>Amce Inc.</Company> <NetRevenue>1000</NetRevenue> </tbl_sp_Test_2_s> ... </tbl_sp_Test_1_s> ... </Root>




Reply With Quote