[xsl] for-each-group in XSL 2.0

Subject: [xsl] for-each-group in XSL 2.0
From: Alejandro Lasebnik <ale@xxxxxxxxxxx>
Date: Tue, 17 Aug 2004 17:37:19 +0200
I have a simple code in XSL : If I use the standard for-each, works fine,
but when I use the for-each-group I receive an error... for-each-group must
not be used here...or something like that.

This is my XSL :

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/TR/WD-xsl";
language="JavaScript">
 
<!--<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
     version="2.0" language="JavaScript"> -->

 <xsl:template match="/">
 <div onClick="clickType(this);">
 <xsl:element name="SELECT MULTIPLE">
 
 <xsl:for-each-group select="xml/rs:data/z:row" group-by="@typeCode">
     
     <xsl:element name="OPTION">
     
      <xsl:value-of select="@typeName"/>
     
      <xsl:attribute name="VALUE">
      <xsl:value-of select="@typeCode"/>
     </xsl:attribute>
        
     </xsl:element>
   </xsl:for-each-group>
  </xsl:element>
 </div>
 
 </xsl:template>
</xsl:stylesheet>


In my html I also have changed the object dll

<script language="javascript"> 
   // Load XML 
  //var xmlDOC = new ActiveXObject("Microsoft.XMLDOM")
  var xmlDOC = new ActiveXObject("MSXML2.DOMDocument.3.0")
  xmlDOC.async= false
  xmlDOC.load("units.asp");
  window.alert(xmlDOC.documentElement.xml);
  
  // Load the XSL
  //var xslDOC = new ActiveXObject("Microsoft.XMLDOM")
  var xslDOC = new ActiveXObject("MSXML2.DOMDocument.3.0")
  xslDOC.async = false
  xslDOC.load("units.xsl")
  
  // Transform
  document.write(xmlDOC.transformNode(xslDOC))
  
  </script>

I receive my XML from a standard XML stream retrived by ADO (from my VB DLL)
The  XML stream:

<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
 xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
 xmlns:rs='urn:schemas-microsoft-com:rowset'
 xmlns:z='#RowsetSchema'>
<s:Schema id='RowsetSchema'>
 <s:ElementType name='row' content='eltOnly'>
  <s:AttributeType name='unitCode' rs:number='1' rs:nullable='true'
    rs:write='true'>
   <s:datatype dt:type='int' dt:maxLength='4' rs:precision='10'
    rs:fixedlength='true'/>
  </s:AttributeType>
  <s:AttributeType name='unitName' rs:number='2' rs:nullable='true'
    rs:write='true'>
   <s:datatype dt:type='string' dt:maxLength='30'/>
  </s:AttributeType>
  <s:AttributeType name='typeCode' rs:number='3' rs:nullable='true'
    rs:write='true'>
   <s:datatype dt:type='i2' dt:maxLength='2' rs:precision='5'
    rs:fixedlength='true'/>
  </s:AttributeType>
  <s:AttributeType name='typeName' rs:number='4' rs:nullable='true'
    rs:write='true'>
   <s:datatype dt:type='string' dt:maxLength='20'/>
  </s:AttributeType>
  <s:extends type='rs:rowbase'/>
 </s:ElementType>
</s:Schema>
<rs:data>
 <z:row unitCode='100' unitName='Falcon' typeCode='1'
   typeName='Application'/>
 <z:row unitCode='120' unitName='TimeLOG' typeCode='1'
   typeName='Application'/>
 <z:row unitCode='140' unitName='Syncomm' typeCode='1'
   typeName='Application'/>
 <z:row unitCode='301' unitName='SY-780/A' typeCode='3'
   typeName='T&#x26;A unit'/>
 <z:row unitCode='302' unitName='SY-760' typeCode='3'
   typeName='T&#x26;A unit'/>
 <z:row unitCode='303' unitName='SY-715' typeCode='3'
   typeName='T&#x26;A unit'/>
 <z:row unitCode='304' unitName='SY-711' typeCode='3'
   typeName='T&#x26;A unit'/>
 <z:row unitCode='400' unitName='SY-400/A' typeCode='4'
   typeName='Controller'/>
 <z:row unitCode='450' unitName='Master' typeCode='4'
   typeName='Controller'/>
 <z:row unitCode='500' unitName='SY-65/A' typeCode='5'
   typeName='Converter'/>
 <z:row unitCode='700' unitName='Print-X/V' typeCode='7'
   typeName='Biometric Only'/>
 <z:row unitCode='701' unitName='Print-X/I' typeCode='7'
   typeName='Biometric Only'/>
 <z:row unitCode='710' unitName='PrintX-40' typeCode='7'
   typeName='Biometric Only'/>
 <z:row unitCode='800' unitName='PRX-30' typeCode='8'
   typeName='Readers'/>
 <z:row unitCode='0' unitName='No unit' typeCode='0' typeName='None'/>
</rs:data>
</xml> 

All that I've found in http://www.dpawson.co.uk/xsl/rev2/grouping.html did
not help me.

It seems to be simple...and I don't understant why it doesn't work.

Thanks in advance !
____________________________________________
 Alejandro Lasebnik
Technical Support Department
ale@xxxxxxxxxxx
SYnel Industries LTD.
Tel : 972-4-9596745
Fax: 972-4-9590729
 
**************************************************************************************************
The contents of this email and any attachments are confidential.
They are intended for the named recipient(s) only.
If you have received this email in error please notify the system manager or  the 
sender immediately and do not disclose the contents to anyone or make copies.

** eSafe scanned this email for viruses, vandals and malicious content. **
**************************************************************************************************

Current Thread