[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Multi Level Grouping using Muenchian Grouping

Subject: Multi Level Grouping using Muenchian Grouping
From: robert.parsons@xxxxxxxxxxxxxx
Date: Wed, 31 Jul 2002 11:40:06 +0000 (GMT)
gmav software
Hi

I have attempted to implement multi level grouping using Muenchian
Grouping. My attempt is based on the example in the XSL List archive,
but somewhere along the line I seem to have lost the plot. Could
someone look at my attempt and point me in the right direction. The
source XML XSLT and required output are shown below.

Source XML

<?xml version="1.0" encoding="UTF-8" ?>
<assets>
   <asset level="1" id="2">
      <assetname>OSSP SW Management</assetname>

     
<url>http://rochstrweb.rochstr.gmav.gecm.com/avionic-systems/engineeri
ng/software/assets/supp_policy/OSSP_SW_Management.doc</url>

      <reference>V6.0</reference>

      <processareas>
         <processarea>2</processarea>

         <processarea>4</processarea>
      </processareas>
   </asset>

   <asset level="2" id="23">
      <assetname>Software Strategy and Tailoring Process</assetname>

     
<url>http://www4.rochstr.gmav.gecm.com/ENG/sw_eng/assets/as_assets/gen
_docs/as_pi_wi/as-pi-wi-006.doc</url>

      <reference>AS/PI/WI/006</reference>

      <processareas>
         <processarea>2</processarea>
      </processareas>
   </asset>

   <asset level="1" id="1">
      <assetname>OSSP SW Types</assetname>

     
<url>http://rochstrweb.rochstr.gmav.gecm.com/avionic-systems/engineeri
ng/software/assets/supp_policy/OSSP_SW_Types.doc</url>

      <reference>V4.0</reference>

      <processareas>
         <processarea>3</processarea>
      </processareas>
   </asset>

   <asset level="1" id="1">
      <assetname>OSSP SW Types</assetname>

     
<url>http://rochstrweb.rochstr.gmav.gecm.com/avionic-systems/engineeri
ng/software/assets/supp_policy/OSSP_SW_Types.doc</url>

      <reference>V4.0</reference>

      <processareas>
         <processarea>2</processarea>
      </processareas>
   </asset>
</assets>

XSLT

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   <xsl:output method="html" encoding="utf-8" />

   <xsl:key name="assets-by-processarea" match="asset"
use="processareas/processarea" />

   <xsl:key name="assets-by-level" match="asset"
use="concat(processareas/processarea, ' ',@level)" />

   <xsl:variable name="process" select="key('assets-by-processarea',
'2 ')" />

   <xsl:template match="assets">
      <xsl:for-each
select="$process[generate-id()=generate-id(key('assets-by-level',
      concat(processareas/processarea, ' ',@level))[1])]">
         <xsl:if test="(@level='1')">
            <h1>AS Policies:</h1>
         </xsl:if>

         <xsl:if test="(@level='2')">
            <h1>General:</h1>
         </xsl:if>
		
         <a href="url"><xsl:value-of select="assetname"/></a>
      </xsl:for-each>
   </xsl:template>
</xsl:stylesheet>

HTML required output assuming processarea = 2

AS Policies

OSSP SW Types
OSSP SW Management

General

Software Strategy and Tailoring Process

I have managed to get this working to the extent that it would pick
out first entry at each level, but in trying to get it to get the
required data It doesnt' work at all at the moment. 

TIA

Rob



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.