Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Filter a Muenchian Group

From: la.brunning@----------.---
To: NULL
Date: 12/6/2006 8:27:00 AM

Hello,

I am trying to filter a Muenchian grouping I have created. I think I am
fairly close, but I am not quite sure where to apply my filter; its
been some time since I did any work with XSLT. An example of my XML;

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="Structure.xsl" type="text/xsl"?>
<dataroot xmlns:od="urn:schemas-microsoft-com:officedata">
<CostCentre>
<ServiceOrder>1</ServiceOrder>
<Service>Directorate Management Team</Service>
<ServiceDivisionOrder>10</ServiceDivisionOrder>
<ServiceDivisionName>DMT</ServiceDivisionName>
<SectionOrder>A</SectionOrder>
<Section>Service Management and Development</Section>
<CostCentreID>6000</CostCentreID>
</CostCentre>
<CostCentre>
<ServiceOrder>2</ServiceOrder>
<Service>Commissioning and Partnership Services</Service>
<ServiceDivisionOrder>20</ServiceDivisionOrder>
<ServiceDivisionName>Commissioning and Partnership
Services</ServiceDivisionName>
<SectionOrder>A</SectionOrder>
<Section>Commissioning and Partnerships</Section>
<CostCentreID>600N</CostCentreID>
</CostCentre>

There are several cost centres in each section, several sections in
each service division and several service divisions in each service. I
would like to group by service, service division and then section. So
far I have managed to get the following XSL;

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="AllServices" match="CostCentre" use="Service"/>
<xsl:key name="AllServiceDivisions" match="CostCentre"
use="concat(Service ';' ServiceDivisionName)"/>
<xsl:template match="/">
<html>
<body>
<ol>
<xsl:for-each
select="//CostCentre[generate-id(.)=generate-id(key('AllServices',Service))]">
<xsl:sort select="ServiceOrder" data-type="number" />
<li><xsl:value-of select="Service" /></li>
<xsl:variable name="currentService">
<xsl:value-of select="Service"/>
</xsl:variable>
<ul>
<xsl:for-each
select="//CostCentre[generate-id(.)=generate-id(key('AllServiceDivisions',concat(Service
';' ServiceDivisionName)))] ">
<xsl:sort select="ServiceDivisionOrder" data-type="number" />
<li><xsl:value-of select="ServiceDivisionName" /></li>
</xsl:for-each>
</ul>
</xsl:for-each>
</ol>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

I *think* I have made the variable correctly, but am I totally lost at
where to apply the filter (using $currentService). Currently, as you
can imagine, I get all service divisions in each service, rather than
just the service divisions for that service. I have tried several
syntaxes and several locations but with no such luck. Once I get this
right, I believe I can crack the rest. Can anyone shed any light on
where and how I should apply the filter??? Thanks.



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent