Question: The xml is as below:

```
<Words num="1">
    <Word>
        <search>Apple</search>
        <replace>Fruit</replace>
    </Word>
    <Word num="2">
        <search>Honda</search>
        <replace>Car</replace>
    </Word>
    <Word num="3">
        <search>Banana</search>
        <replace>Fruit</replace>
    </Word>
</Words>

```

I want to convert it in a table in html output (not xml output) - using grouping functionality (group by replace). 

```
<table>
   <tr><td>Replace: Fruit</td></tr>
   <tr><td>Replace: Car</td></tr>
</table>

```

The code I've written is:

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

   <xsl:template match="/">
      <html>             
         <body>                
            <table border="1">
               <xsl:for-each-group select="Words/Word" group-by="replace">
                  <tr>
                     <td>Replace: <xsl:value-of select="current-grouping-key()"/></td>
                  </tr>               
               </xsl:for-each-group>
            </table>
         </body>
      </html>       
   </xsl:template>
</xsl:stylesheet>     

```

When opened xml file(linked with xslt) in Firefox, it returns "Error during XSLT transformation: XSLT transformation failed."

Can anyone provide me with guidance?

Thanks.

Answer: 
The XSLT supported in browsers like Mozilla, IE, Opera, Chrome is limited to XSLT version 1.0 which does not support `for-each-group`. With XSLT 1.0 you are limited to Muenchian grouping <http://www.jenitennison.com/xslt/grouping/muenchian.xml>.

As an alternative you could consider using Saxon CE, which provides XSLT 2.0 in the browser. See <http://www.saxonica.com/ce/index.xml>.
XSLT 2.0 is not natively supported in Firefox. Please refer the below link:
<https://developer.mozilla.org/en/docs/XSLT_2.0>

So I used the below XSLT using Muenchian grouping.

```
<?xml version="1.0" encoding="UTF-8"?>    
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" />
<xsl:key name="Kreplace" match="Word" use="replace"/>
   <xsl:template match="Words">
      <html>             
         <body>                
            <table border="1">
                 <tr>
                  <xsl:for-each select="Word[generate-id(.)=generate-id(key('Kreplace',replace)[1])]">
                     <td>Replace: <xsl:value-of select="replace"/></td>
                     </xsl:for-each>
                   </tr>               
            </table>
         </body>
      </html>       
   </xsl:template>
</xsl:stylesheet> 

```

Now I viewed the same XML in Firefox and I got the required output and correct view