Go Premium for a chance to win a PS4. Enter to Win

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 323
  • Last Modified:

Muenchian grouping

I am trying to aplly xsl transfor on a Muenchian grouping logic involving keys.But i get error as below.
Do I need a special xslt procesor for this .I read that "xt" and pre May 2000 MSXML are not good.What parser should I use ?


Invalid factory configuration
javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: xsl:key is not allowed in this position in the stylesheet!
  • 3
2 Solutions
Hi Amhicraig,

The error you show means that your XSLT stylesheet is not correct. In your case, you have probably put the xsl:key instruction on some other level than the root level (the root level means the level right under xsl:stylesheet instruction), but it is a bit hard to tell you how to fix it without seeing your actual code.

Muenchian grouping is a rather advanced technique and it can be tricky to get it right. Even experienced XSLT programmers sometimes have trouble with it. If you have the possibility to choose your XSLT processor and if you are still learning XSLT, I'd strongly advice you to use XSLT 2.0, as it is easier to learn, has more instructions (making complex tasks a one-liner where you needed recursive programming techniques in 1.0) and, perhaps most important to you now, has a standard xsl:for-each-group instruction to handle just about all grouping scenarios.

A good XSLT 2.0 processor is Saxon 8.9. It is very stable, reliable, fast and comes for both the .NET and the Java platform. There is a lot of documentation and the owner maintains a mailing list that has very quick response rates. You can find Saxon on http://www.saxonica.com. The Saxon-B version is free and open source. Saxon-SA is not free, but it is unlikely that you will need it.

Any XSLT 2.0 processor can also handle XSLT 1.0, but will issue a warning (which you can switch off). Forget about complex Muenchian grouping and try Saxon with XSLT 2.0 (and now, I am not a stake holder ;)

If you need some helping getting your grouping problem up and running, show some input and (expected) output and possibly the current code you have.

-- Abel --
PS: if you do want to stick with XSLT 1.0 (for instance if you need to do client side browser transformations or because of legacy code) you have ample choice. You can use Xalan (Java), Saxon 6.5 (Java and .NET), Libxslt (C++), MSXML (ActiveX), .NET XsltCompiledTransform etc (.NET), Unicorn (C++), AltovaXML (proprietary)

All recent versions of the above are stable processors and there are many more still. Personally, I favor Saxon for stability and XSLT 2.0, and I favor MS .NET XLST when I need speed (it seems to be the fastest XSLT 1.0 processor around, but I don't find their error messages all too clear).
why do you give a B grade? If you weren't entirely satisfied with the answer, you can use the Comment feature of EE to ask for more information, more help etc. That's what we're here for. A B-grade (or C) means that there's something left to desire. On EE it is common practice to grade A when an anwsers comes quick and when it helps you out enough. If it doesn't, it is common practice to ask for more before grading a B.

The points are not interesting to me, I just like to help and now it looks like you may need some more help ;)

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now