+2007-07-07 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Maciej.
+
+ http://bugs.webkit.org/show_bug.cgi?id=14525
+ Support exslt:node-set()
+
+ * fast/xsl/exslt-node-set-expected.txt: Added.
+ * fast/xsl/exslt-node-set.xml: Added.
+ * fast/xsl/exslt-node-set.xsl: Added.
+
2007-07-06 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
--- /dev/null
+Test that exslt:node-set() function is supported.
+
+SUCCESS
--- /dev/null
+<?xml-stylesheet type="text/xsl" href="exslt-node-set.xsl"?>
+<doc/>
--- /dev/null
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:exslt="http://exslt.org/common"
+ exclude-result-prefixes="exslt">
+
+<xsl:variable name="x">
+ <y/>
+</xsl:variable>
+
+<xsl:template match="doc">
+ <html>
+ <body>
+ <script>if (window.layoutTestController) layoutTestController.dumpAsText();</script>
+ <p>Test that exslt:node-set() function is supported.</p>
+ <xsl:apply-templates select="exslt:node-set($x)/*"/>
+ </body>
+ </html>
+</xsl:template>
+
+<xsl:template match="y">
+ <p>SUCCESS</p>
+</xsl:template>
+
+</xsl:stylesheet>
+2007-07-07 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Maciej.
+
+ http://bugs.webkit.org/show_bug.cgi?id=14525
+ Support exslt:node-set()
+
+ Test: fast/xsl/exslt-node-set.xml
+
+ * xml/XSLTExtensions.cpp: Added.
+ (WebCore::exsltNodeSetFunction): A copy of exslt:node-set() implementation
+ from libexslt 1.1.11 (shipped with Tiger).
+ (WebCore::registerXSLTExtensions): This function registers any WebCore-provided
+ extensions on a context. Currently, the only extension is exslt:node-set().
+ * xml/XSLTExtensions.h: Added.
+
+ * xml/XSLTProcessor.cpp:
+ (WebCore::XSLTProcessor::transformToString):
+ Register extensions when creating a context.
+
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * WebCoreSources.bkl:
+ Add XSLTExtensions.{h,cpp} to projects.
+
2007-07-06 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
xml/XPathVariableReference.cpp \
xml/XSLImportRule.cpp \
xml/XSLStyleSheet.cpp \
+ xml/XSLTExtensions.cpp \
xml/XSLTProcessor.cpp
gdk-port {
RelativePath="..\xml\XSLStyleSheet.h"
>
</File>
+ <File
+ RelativePath="..\xml\XSLTExtensions.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\xml\XSLTExtensions.h"
+ >
+ </File>
<File
RelativePath="..\xml\XSLTProcessor.cpp"
>
E1EC29A00BB04C6B00EA187B /* XPathNodeSet.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EC299E0BB04C6B00EA187B /* XPathNodeSet.h */; };
E1F0424609839389006694EA /* xmlhttprequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1F0424409839389006694EA /* xmlhttprequest.cpp */; };
E1F0424709839389006694EA /* xmlhttprequest.h in Headers */ = {isa = PBXBuildFile; fileRef = E1F0424509839389006694EA /* xmlhttprequest.h */; };
+ E1F1E82F0C3C2BB9006DB391 /* XSLTExtensions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1F1E82D0C3C2BB9006DB391 /* XSLTExtensions.cpp */; };
+ E1F1E8300C3C2BB9006DB391 /* XSLTExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = E1F1E82E0C3C2BB9006DB391 /* XSLTExtensions.h */; };
ED048ABC0833F132006E1E67 /* textAreaResizeCorner.tiff in Resources */ = {isa = PBXBuildFile; fileRef = ED048ABB0833F132006E1E67 /* textAreaResizeCorner.tiff */; };
ED2BA83C09A24B91006C0AC4 /* DocumentMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = ED2BA83B09A24B91006C0AC4 /* DocumentMarker.h */; settings = {ATTRIBUTES = (Private, ); }; };
ED501DC60B249F2900AE18D9 /* EditorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED501DC50B249F2900AE18D9 /* EditorMac.mm */; };
E1EC299E0BB04C6B00EA187B /* XPathNodeSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPathNodeSet.h; sourceTree = "<group>"; };
E1F0424409839389006694EA /* xmlhttprequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xmlhttprequest.cpp; sourceTree = "<group>"; };
E1F0424509839389006694EA /* xmlhttprequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xmlhttprequest.h; sourceTree = "<group>"; };
+ E1F1E82D0C3C2BB9006DB391 /* XSLTExtensions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XSLTExtensions.cpp; sourceTree = "<group>"; };
+ E1F1E82E0C3C2BB9006DB391 /* XSLTExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XSLTExtensions.h; sourceTree = "<group>"; };
ED048ABB0833F132006E1E67 /* textAreaResizeCorner.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = textAreaResizeCorner.tiff; sourceTree = "<group>"; };
ED2BA83B09A24B91006C0AC4 /* DocumentMarker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentMarker.h; sourceTree = "<group>"; };
ED501DC50B249F2900AE18D9 /* EditorMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = EditorMac.mm; path = mac/EditorMac.mm; sourceTree = "<group>"; };
85217E010A5ECD4700DB8D00 /* XSLImportRule.h */,
BC06F24906D18A7E004A6FA3 /* XSLStyleSheet.cpp */,
BC06F24A06D18A7E004A6FA3 /* XSLStyleSheet.h */,
+ E1F1E82D0C3C2BB9006DB391 /* XSLTExtensions.cpp */,
+ E1F1E82E0C3C2BB9006DB391 /* XSLTExtensions.h */,
BC06F24B06D18A7E004A6FA3 /* XSLTProcessor.cpp */,
BC06F24C06D18A7E004A6FA3 /* XSLTProcessor.h */,
);
BC5A86B60C3367E800EEA649 /* JSDOMSelection.h in Headers */,
BC073BAA0C399B1F000F5979 /* FloatConversion.h in Headers */,
BCA85A100C3AEAF4006F8308 /* DOMSVGNumberInternal.h in Headers */,
+ E1F1E8300C3C2BB9006DB391 /* XSLTExtensions.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
BCEFAF4E0C317E6900FA81F6 /* JSEventCustom.cpp in Sources */,
BC5A86840C33676000EEA649 /* DOMSelection.cpp in Sources */,
BC5A86B50C3367E800EEA649 /* JSDOMSelection.cpp in Sources */,
+ E1F1E82F0C3C2BB9006DB391 /* XSLTExtensions.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
xml/XPathVariableReference.cpp
xml/XSLImportRule.cpp
xml/XSLStyleSheet.cpp
+ xml/XSLTExtensions.cpp
xml/XSLTProcessor.cpp
xml/xmlhttprequest.cpp
</set>
--- /dev/null
+/**
+ * Copyright (C) 2001-2002 Thomas Broyer, Charlie Bozeman and Daniel Veillard.
+ * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is fur-
+ * nished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
+ * NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
+ * NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the authors shall not
+ * be used in advertising or otherwise to promote the sale, use or other deal-
+ * ings in this Software without prior written authorization from him.
+ */
+
+#include "config.h"
+
+#if ENABLE(XSLT)
+
+#include <libxml/xpathInternals.h>
+
+#include <libxslt/xsltutils.h>
+#include <libxslt/extensions.h>
+#include <libxslt/extra.h>
+
+namespace WebCore {
+
+// FIXME: This code is taken from libexslt 1.1.11; should sync with newer versions.
+static void exsltNodeSetFunction(xmlXPathParserContextPtr ctxt, int nargs)
+{
+ xmlChar *strval;
+ xmlNodePtr retNode;
+ xmlXPathObjectPtr ret;
+
+ if (nargs != 1) {
+ xmlXPathSetArityError(ctxt);
+ return;
+ }
+
+ if (xmlXPathStackIsNodeSet(ctxt)) {
+ xsltFunctionNodeSet(ctxt, nargs);
+ return;
+ }
+
+ strval = xmlXPathPopString(ctxt);
+ retNode = xmlNewDocText(NULL, strval);
+ ret = xmlXPathNewValueTree(retNode);
+ if (ret == NULL) {
+ xsltGenericError(xsltGenericErrorContext,
+ "exsltNodeSetFunction: ret == NULL\n");
+ } else {
+ ret->type = XPATH_NODESET;
+ }
+
+ if (strval != NULL)
+ xmlFree(strval);
+
+ valuePush(ctxt, ret);
+}
+
+void registerXSLTExtensions(xsltTransformContextPtr ctxt)
+{
+ xsltRegisterExtFunction(ctxt, (const xmlChar*)"node-set", (const xmlChar*)"http://exslt.org/common", exsltNodeSetFunction);
+}
+
+}
+
+#endif
--- /dev/null
+/**
+ * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef XSLTExtensions_h
+#define XSLTExtensions_h
+
+#if ENABLE(XSLT)
+
+#include <libxslt/xsltInternals.h>
+
+namespace WebCore {
+
+void registerXSLTExtensions(xsltTransformContextPtr ctxt);
+
+}
+
+#endif
+#endif
#include "Text.h"
#include "TextResourceDecoder.h"
#include "XMLTokenizer.h"
+#include "XSLTExtensions.h"
#include "loader.h"
#include "markup.h"
#include <libxslt/imports.h>
sheet->omitXmlDeclaration = true;
xsltTransformContextPtr transformContext = xsltNewTransformContext(sheet, sourceDoc);
+ registerXSLTExtensions(transformContext);
// This is a workaround for a bug in libxslt.
// The bug has been fixed in version 1.1.13, so once we ship that this can be removed.