S
shall
I want to have a grouping by action on this XLM.
=======================
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="Demo_xslt_Help.xsl"?>
<XML>
<Title>
<Planning_Unit>testA</Planning_Unit>
<ProgramName>it test</ProgramName>
<Time_Frame>May</Time_Frame>
</Title>
<Header>
<GOALNAME>Goal# 1 </GOALNAME>
</Header>
<Header_2>
<OBJNAME>Obj# 1 </OBJNAME>
</Header_2>
<Header_3 Total="Total" Female="Female" Male="Male"></Header_3>
<adetail>
<ATOTAL>76</ATOTAL>
<AFEM>17</AFEM>
<AMALE>59</AMALE>
<goalgroup>2011.1012.1.1</goalgroup>
</adetail>
<adetail>
<ATOTAL>599</ATOTAL>
<AFEM>229</AFEM>
<AMALE>370</AMALE>
<goalgroup>2011.1012.1.1</goalgroup>
</adetail>
<Header>
<GOALNAME>Goal# 4 </GOALNAME>
</Header>
<Header_2>
<OBJNAME>Obj# 3 </OBJNAME>
</Header_2>
<Header_3 Total="Total" Female="Female" Male="Male"></Header_3>
<adetail>
<ATOTAL>0</ATOTAL>
<AFEM>0</AFEM>
<AMALE>0</AMALE>
<goalgroup>2011.1012.4.3</goalgroup>
</adetail>
<adetail>
<ATOTAL>3</ATOTAL>
<AFEM>1</AFEM>
<AMALE>2</AMALE>
<goalgroup>2011.1012.4.3</goalgroup>
</adetail>
</XML>
===================================
<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform">
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="child::Header">
<table>
<tr style="background-color:#ccff00">
<td><xsl:value-of select="GOALNAME"/></td>
</tr>
</table>
</xsl:template>
<xsl:template match="child::Header_2">
<table>
<tr style="background-color:#ccff00">
<td><xsl:value-of select="OBJNAME"/></td>
</tr>
</table>
</xsl:template>
<xsl:template match="child::Header_3">
<table>
<tr style="background-color:#ccff00">
<th>ATOTAL</th>
<th>DFEM</th>
<th>DMALE</th>
</tr>
<xsl:call-template name="ShowEmployeesInTeam">
</xsl:call-template>
</table>
</xsl:template>
<xsl:template name="ShowEmployeesInTeam">
<xsl:for-each-group select="XML/adetail" group-by="/../../
goalgroup">
<xsl:comment>
<xsl:value-of select="current-grouping-key()"/>
</xsl:comment>
<xsl:for-each select="current-group()">
<tr style="background-color:#cccccc">
<td><xsl:value-of select="ATOTAL"/></td>
<td><xsl:value-of select="AFEM"/></td>
<td><xsl:value-of select="AMALE"/></td>
</tr>
</xsl:for-each>
</xsl:for-each-group>
</xsl:template>
</xsl:stylesheet>
==============================
I have tried several options, but no success.
Below is what I would like for my output to look like:
===================================
<table>
<tr><td>Goal# 1</td></tr></table>
<table>
<tr><td>Obj# 1</td></tr></table>
<table>
<tr><th>Total</th><th>Female</th><th>Male</th></tr>
<tr><td>76</td><td>17</td><td>59</td></tr>
<tr><td>599</td><td>229</td><td>370</td></tr>
</table>
<table>
<tr><td>Goal# 4</td></tr></table>
<table>
<tr><td>Obj# 3</td></tr></table>
<table>
<tr><th>Total</th><th>Female</th><th>Male</th></tr>
<tr><td>0</td><td>0</td><td>0</td></tr>
<tr><td>3</td><td>1</td><td>2</td></tr>
</table>
=============================
Is this possible with XSL?
TIA
Steve
=======================
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="Demo_xslt_Help.xsl"?>
<XML>
<Title>
<Planning_Unit>testA</Planning_Unit>
<ProgramName>it test</ProgramName>
<Time_Frame>May</Time_Frame>
</Title>
<Header>
<GOALNAME>Goal# 1 </GOALNAME>
</Header>
<Header_2>
<OBJNAME>Obj# 1 </OBJNAME>
</Header_2>
<Header_3 Total="Total" Female="Female" Male="Male"></Header_3>
<adetail>
<ATOTAL>76</ATOTAL>
<AFEM>17</AFEM>
<AMALE>59</AMALE>
<goalgroup>2011.1012.1.1</goalgroup>
</adetail>
<adetail>
<ATOTAL>599</ATOTAL>
<AFEM>229</AFEM>
<AMALE>370</AMALE>
<goalgroup>2011.1012.1.1</goalgroup>
</adetail>
<Header>
<GOALNAME>Goal# 4 </GOALNAME>
</Header>
<Header_2>
<OBJNAME>Obj# 3 </OBJNAME>
</Header_2>
<Header_3 Total="Total" Female="Female" Male="Male"></Header_3>
<adetail>
<ATOTAL>0</ATOTAL>
<AFEM>0</AFEM>
<AMALE>0</AMALE>
<goalgroup>2011.1012.4.3</goalgroup>
</adetail>
<adetail>
<ATOTAL>3</ATOTAL>
<AFEM>1</AFEM>
<AMALE>2</AMALE>
<goalgroup>2011.1012.4.3</goalgroup>
</adetail>
</XML>
===================================
<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform">
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="child::Header">
<table>
<tr style="background-color:#ccff00">
<td><xsl:value-of select="GOALNAME"/></td>
</tr>
</table>
</xsl:template>
<xsl:template match="child::Header_2">
<table>
<tr style="background-color:#ccff00">
<td><xsl:value-of select="OBJNAME"/></td>
</tr>
</table>
</xsl:template>
<xsl:template match="child::Header_3">
<table>
<tr style="background-color:#ccff00">
<th>ATOTAL</th>
<th>DFEM</th>
<th>DMALE</th>
</tr>
<xsl:call-template name="ShowEmployeesInTeam">
</xsl:call-template>
</table>
</xsl:template>
<xsl:template name="ShowEmployeesInTeam">
<xsl:for-each-group select="XML/adetail" group-by="/../../
goalgroup">
<xsl:comment>
<xsl:value-of select="current-grouping-key()"/>
</xsl:comment>
<xsl:for-each select="current-group()">
<tr style="background-color:#cccccc">
<td><xsl:value-of select="ATOTAL"/></td>
<td><xsl:value-of select="AFEM"/></td>
<td><xsl:value-of select="AMALE"/></td>
</tr>
</xsl:for-each>
</xsl:for-each-group>
</xsl:template>
</xsl:stylesheet>
==============================
I have tried several options, but no success.
Below is what I would like for my output to look like:
===================================
<table>
<tr><td>Goal# 1</td></tr></table>
<table>
<tr><td>Obj# 1</td></tr></table>
<table>
<tr><th>Total</th><th>Female</th><th>Male</th></tr>
<tr><td>76</td><td>17</td><td>59</td></tr>
<tr><td>599</td><td>229</td><td>370</td></tr>
</table>
<table>
<tr><td>Goal# 4</td></tr></table>
<table>
<tr><td>Obj# 3</td></tr></table>
<table>
<tr><th>Total</th><th>Female</th><th>Male</th></tr>
<tr><td>0</td><td>0</td><td>0</td></tr>
<tr><td>3</td><td>1</td><td>2</td></tr>
</table>
=============================
Is this possible with XSL?
TIA
Steve