[xsl] Group-by Question

Subject: [xsl] Group-by Question
From: "Michael Donabauer" <michael.donabauer@xxxxxxxxxxxx>
Date: Wed, 22 Jun 2005 08:37:07 +0200
Hi xsl'ers,

thanks for your help, now i have joined two files together with the
following xsl-code: 

#############################################################################################
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:param name="host" />
<xsl:param name="lspv" />

 <xsl:template match="SymCLI_ML/Symmetrix">
 <HTML>
 <BODY>
 <H3><xsl:value-of select="$host" /> - Storageusage</H3>
 <TABLE BORDER="1">
<tr bgcolor="#9acd32">
	<TH>Symm-Dev</TH>
	<TH>Dev-State</TH>
	<TH>Dev-Conf</TH>
	<TH>Meta-Dev</TH>
	<TH>Size in GB</TH>
	<TH>AIX-Device</TH>
	<TH>AIX-Volumegroup</TH>
 </tr>
 <xsl:for-each select="Device[not(@dev_name =
preceding-sibling::Device/@dev_name)]">
    <xsl:variable name="vId" select="Front_End/Port/@pd_name"/>
	<TR>
		<TD>
			  <xsl:value-of select="@dev_name"/>
			  <td><xsl:value-of select="@status"/></td>
			  <td><xsl:value-of
select="@configuration"/></td>
			  <td><xsl:value-of select="Flags/@meta"/></td>
			  <td><xsl:value-of select="Capacity/@megabytes
div 1000"/></td>
		</TD>
		<TD>	
			  <xsl:value-of
select="document($lspv)/SymCLI_ML/Symmetrix/Device/Front_End/Port[@pd_name=$vId]/@pd_name"/>
			  <td>
			  <xsl:value-of
select="document($lspv)/SymCLI_ML/Symmetrix/Device/Front_End/Port[@pd_name=$vId]/@aix_vg"/>
			  </td>
		</TD>
	</TR>
  </xsl:for-each>
 </TABLE>
 </BODY>
 </HTML>
 </xsl:template>

 </xsl:stylesheet>
#############################################################################################

an excerpt of the output looks like this in html:

#############################################################################################
<HTML>
<BODY>
<H3>lirp10 - Storageusage</H3>
<TABLE BORDER="1">
<tr bgcolor="#9acd32">
<TH>Symm-Dev</TH>
<TH>Dev-State</TH>
<TH>Dev-Conf</TH>
<TH>Meta-Dev</TH>
<TH>Size in GB</TH>
<TH>AIX-Device</TH>
<TH>AIX-Volumegroup</TH>
</tr>
<TR>
<TD>0021<td>Ready</td>
<td>RDF1+R-S</td>
<td>Head</td>
<td>46.035</td>
</TD>
<TD>/dev/rhdiskpower0<td>P21vg</td>
</TD>
</TR>
<TR>
<TD>0025<td>Ready</td>
<td>RDF1+R-S</td>
<td>Head</td>
<td>46.035</td>
</TD>
<TD>/dev/rhdiskpower1<td>P21vg</td>
</TD>
</TR>
<TR>
<TD>0029<td>Ready</td>
<td>RDF1+R-S</td>
<td>Head</td>
<td>46.035</td>
</TD>
<TD>/dev/rhdiskpower2<td>P21vg</td>
</TD>
</TR>
<TR>
<TD>002D<td>Ready</td>
<td>RDF1+R-S</td>
<td>Head</td>
<td>46.035</td>
</TD>
<TD>/dev/rhdiskpower3<td>P21vg</td>
</TD>
<TR>
<TD>01CE<td>Ready</td>
<td>RDF1+R-S</td>
<td>Head</td>
<td>46.035</td>
</TD>
<TD>/dev/rhdiskpower22<td>P21vg</td>
</TD>
</TR>
<TR>
<TD>01D2<td>Ready</td>
<td>RDF1+R-S</td>
<td>Head</td>
<td>46.035</td>
</TD>
<TD>/dev/rhdiskpower23<td>P21vg</td>
</TD>
</TR>
<TR>
<TD>01D6<td>Ready</td>
<td>RDF1+R-S</td>
<td>Head</td>
<td>46.035</td>
</TD>
<TD>/dev/rhdiskpower24<td>P21vg</td>
</TD>
</TR>
<TR>
<TD>0000<td>Write Disabled</td>
<td>2-Way Mir</td>
<td>None</td>
<td>0.023</td>
</TD>
<TD><td></td>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
#############################################################################################

you see there is a column called AIX-Volumegroup (= @aix_vg), now i
want to group by @aix_vg and sum up the "Size in GB". Could i do that in
one script? As already mentioned, i'm net to xsl!

thx
::mike

Michael Donabauer
Informatik Services
Tel:+43 (0)732-9000-3359
Mobil: +43 (0)664/60165 3359
Fax: +43 (0) 732 9000 53359
Mail: michael.donabauer@xxxxxxxxxxxx

Current Thread