Subject: Re: Wanted: Extension functions using DOM interfaces From: "Juergen Hermann" <jhe@xxxxxxxxxxx> Date: Fri, 09 Jun 2000 16:59:09 +0100 |
On Fri, 9 Jun 2000 14:44:37 +0100, Kay Michael wrote: >I'm looking at changing Saxon to pass DOM NodeList and DocumentFragment >objects to extension functions instead of the current proprietary Saxon >classes: this would make Saxon extension functions compatible with Xalan. I currently implement most of Saxon's extension functions for Xalan-C. :) Should translate to Java more or less directly, in theory. This is "saxon:range" (plus a 3rd parameter, "step"): XObject* cops_range( XPathExecutionContext& executionContext, const XalanDOMString& theNamespace, const XalanDOMString& functionName, XalanNode* context, const XPathEnvSupport::XObjectArgVectorType& argVec) { // Anzahl der Argumente prüfen if (argVec.size() < 2 || 3 < argVec.size()) { executionContext.error("cops:range erwartet zwei oder drei Argumente!", context); // Obige Funktion KANN laut Doku eine Exception erzeugen, zur Sicherheit // liefern wird einen Rückgabewert return executionContext.getXObjectFactory().createNull(); } // Argumente holen long from = long(floor(argVec[0]->num() + .5)); long to = long(floor(argVec[1]->num() + .5)); long step = 1; if (argVec.size() >= 3) step = long(floor(argVec[2]->num() + .5)); if (!step) step = 1; // Ergebnisliste anlegen und befüllen MutableNodeRefList result(executionContext.createMutableNodeRefList()); for (long num = from; num <= to; num += step) { XalanText* numNode = context->getOwnerDocument()->createTextNode(strNum(num).c_str()); result.addNode(static_cast<XalanNode*>(numNode)); } return executionContext.getXObjectFactory().createNodeSet(result); } I hope you can grok it, even with the German comments. :) Ciao, Jürgen -- Jürgen Hermann (jhe@xxxxxxxxxxx) WEB.DE AG, Amalienbadstr.41, D-76227 Karlsruhe Tel.: 0721/94329-0, Fax: 0721/94329-22 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Wanted: Extension functions using D, Kay Michael | Thread | RE: Wanted: Extension functions usi, Kay Michael |
ENCODING QUESTION?, Samir Narendra Sarda | Date | RE: Xpath and copy-of, Liu, Ying |
Month |