I can't immediately see what's wrong here. Presumably your trace output shows that the getExtensionClass() method is never called? Running with -t or -T option might give slightly more diagnostic information. I suspect that there is a failure to load the factory class, but the underlying diagnostics are getting masked. You might have to consider patching the Saxon source code to see what's happining: look at the getFactory() method in module com.icl.saxon.style.StyleNodeFactory.
Michael Kay
 -----Original Message-----
From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Sal Mangano
Sent: 01 September 2002 17:53
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Help with adding an extension element

I am trying to implement an extension element.


Saxon 6.5.1 is complaining about an unknown extension.


My stylesheet looks like this:


<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

 xmlns:ckbk="http://com.ora.xsltckbk.CkBkElementFactory" extension-element-prefixes="ckbk">


<xsl:template match="/">

  <ckbk:set-context select="foo"></ckbk:set-context>





My ElementFactory looks like this


package com.ora.xsltckbk;

import com.icl.saxon.style.ExtensionElementFactory;

import org.xml.sax.SAXException;



  * Class CkBkElementFactory. <br>

  * A "Factory" for XSLT Cookbook extension nodes in the stylesheet tree. <br>



public class CkBkElementFactory implements ExtensionElementFactory {



    * Identify the class to be used for stylesheet elements with a given local name.

    * The returned class must extend com.icl.saxon.style.StyleElement

    * @return null if the local name is not a recognised element type in this

    * namespace.



    public Class getExtensionClass(String localname)  {

                        System.out.println("test") ;

        if (localname.equals("set-context")) return CkBkSetContext.class;

        /* if (localname.equals("templtext")) return CkBkTemplText.class; */

        return null;





My class path contains the saxon jar and the jar of my extension and the above factory.

I have tried several variations of the extension namespace to no avail. The error is always:



Error at ckbk:set-context on line 6 of file:/C:/MyProjects/XSLTCookbook/extend/s


  Unknown extension element

Transformation failed: Run-time errors were reported


Please help!