If I understood well, I have to write :
- an external function like this :

import net.sf.saxon.om.FastStringBuffer;
import net.sf.saxon.om.NodeInfo;
   public static String generateId(NodeInfo node)
      FastStringBuffer buffer = new FastStringBuffer(16);
      return buffer.toString();
but I'm not sure about how to write it, compile it, declare it and call it from the query file. Things are mixed in my mind !

----- Message d'origine ----
De : Florent Georges <darkman_spam@yahoo.fr>
À : saxon-help@lists.sourceforge.net
Envoyé le : Mardi, 30 Mai 2006, 1h00mn 13s
Objet : RE: Re : Re : [saxon] How to generate an Identifer in XQuery

enis enis write:

> Nothing is working for me ! :(

>      String node = new String("noeud") ;
>      NodeInfo myid = generateId(node);

  But the goal is to have an extension function.  So you don't have to
test it from Java, but from XQuery.  To quote the response from

    and then calling it as an extension function. (If
    the module is GenerateId in package com.abc.gid, then
    you can call it as

    declare namespace gid = "java:com.abc.gid.GenerateId;


  So try this:

    (: I don't know the package of your class. :)
    declare namespace mp = "java:MyProject";
    let $node := /*[1]

  Just be sure your class is in the classpath.

  I saw too that you import FastStringBuffer from a Xalan package.  But
if you check the javadoc for NodeInfo, you'll see that the type of the
parameter of generateId() is net.sf.saxon.om.FastStringBuffer, so:

    import net.sf.saxon.om.FastStringBuffer;





Faites de Yahoo! votre page d'accueil sur le web pour retrouver directement vos services préférés : vérifiez vos nouveaux mails, lancez vos recherches et suivez l'actualité en temps réel.
Rendez-vous sur http://fr.yahoo.com/set

All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
saxon-help mailing list