darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 1 | /** |
| 2 | * This file is part of the XSL implementation. |
| 3 | * |
| 4 | * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. |
| 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Library General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Library General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Library General Public License |
| 17 | * along with this library; see the file COPYING.LIB. If not, write to |
| 18 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 19 | * Boston, MA 02111-1307, USA. |
| 20 | */ |
| 21 | |
| 22 | #include "config.h" |
| 23 | |
hyatt | 5cc8ab8 | 2006-09-13 22:10:25 +0000 | [diff] [blame] | 24 | #ifdef XSLT_SUPPORT |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 25 | |
darin | 91298e5 | 2006-06-12 01:10:17 +0000 | [diff] [blame] | 26 | #include "XSLTProcessor.h" |
| 27 | |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 28 | #include "Cache.h" |
andersca | 9cf539a | 2006-09-17 18:36:23 +0000 | [diff] [blame] | 29 | #include "CString.h" |
darin | 6f2a3ef | 2006-04-05 21:19:57 +0000 | [diff] [blame] | 30 | #include "DOMImplementation.h" |
darin | b448382 | 2006-06-02 06:30:49 +0000 | [diff] [blame] | 31 | #include "Decoder.h" |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 32 | #include "DocLoader.h" |
darin | 36d1136 | 2006-04-11 16:30:21 +0000 | [diff] [blame] | 33 | #include "DocumentFragment.h" |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 34 | #include "Frame.h" |
darin | 6f2a3ef | 2006-04-05 21:19:57 +0000 | [diff] [blame] | 35 | #include "HTMLDocument.h" |
| 36 | #include "HTMLTokenizer.h" |
darin | b53ebdc | 2006-07-09 15:10:21 +0000 | [diff] [blame] | 37 | #include "LoaderFunctions.h" |
mjs | 63474f3 | 2006-08-01 05:15:40 +0000 | [diff] [blame] | 38 | #include "ResourceLoader.h" |
weinig | f18aae3 | 2006-08-03 21:55:57 +0000 | [diff] [blame] | 39 | #include "Text.h" |
darin | 6f2a3ef | 2006-04-05 21:19:57 +0000 | [diff] [blame] | 40 | #include "loader.h" |
| 41 | #include "markup.h" |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 42 | #include <libxslt/imports.h> |
andersca | cae8bef | 2006-07-21 07:52:10 +0000 | [diff] [blame] | 43 | #include <libxslt/variables.h> |
darin | 6f2a3ef | 2006-04-05 21:19:57 +0000 | [diff] [blame] | 44 | #include <libxslt/xsltutils.h> |
weinig | f18aae3 | 2006-08-03 21:55:57 +0000 | [diff] [blame] | 45 | #include <wtf/Assertions.h> |
| 46 | #include <wtf/Platform.h> |
| 47 | #include <wtf/Vector.h> |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 48 | |
| 49 | namespace WebCore { |
| 50 | |
| 51 | static void parseErrorFunc(void *ctxt, const char *msg, ...) |
| 52 | { |
| 53 | // FIXME: It would be nice to display error messages somewhere. |
weinig | f18aae3 | 2006-08-03 21:55:57 +0000 | [diff] [blame] | 54 | #if !PLATFORM(WIN_OS) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 55 | // FIXME: No vasprintf support. |
weinig | f18aae3 | 2006-08-03 21:55:57 +0000 | [diff] [blame] | 56 | #ifndef ERROR_DISABLED |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 57 | char *errorMessage = 0; |
| 58 | va_list args; |
| 59 | va_start(args, msg); |
| 60 | vasprintf(&errorMessage, msg, args); |
| 61 | LOG_ERROR("%s", errorMessage); |
| 62 | if (errorMessage) |
| 63 | free(errorMessage); |
| 64 | va_end(args); |
| 65 | #endif |
| 66 | #endif |
| 67 | } |
| 68 | |
| 69 | // FIXME: There seems to be no way to control the ctxt pointer for loading here, thus we have globals. |
| 70 | static XSLTProcessor *globalProcessor = 0; |
darin | f4b05b2 | 2006-07-10 05:20:17 +0000 | [diff] [blame] | 71 | static DocLoader *globalDocLoader = 0; |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 72 | static xmlDocPtr docLoaderFunc(const xmlChar *uri, |
| 73 | xmlDictPtr dict, |
| 74 | int options, |
| 75 | void* ctxt, |
| 76 | xsltLoadType type) |
| 77 | { |
| 78 | if (!globalProcessor) |
| 79 | return 0; |
| 80 | |
| 81 | switch (type) { |
| 82 | case XSLT_LOAD_DOCUMENT: { |
| 83 | xsltTransformContextPtr context = (xsltTransformContextPtr)ctxt; |
| 84 | xmlChar *base = xmlNodeGetBase(context->document->doc, context->node); |
| 85 | KURL url((const char*)base, (const char*)uri); |
| 86 | xmlFree(base); |
| 87 | KURL finalURL; |
mjs | 76169ca | 2006-10-05 13:15:04 +0000 | [diff] [blame] | 88 | RefPtr<ResourceLoader> loader = ResourceLoader::create(0, "GET", url); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 89 | DeprecatedString headers; |
| 90 | xmlGenericErrorFunc oldErrorFunc = xmlGenericError; |
| 91 | void *oldErrorContext = xmlGenericErrorContext; |
| 92 | |
mjs | 76169ca | 2006-10-05 13:15:04 +0000 | [diff] [blame] | 93 | Vector<char> data = ServeSynchronousRequest(Cache::loader(), globalDocLoader, loader.get(), finalURL, headers); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 94 | |
| 95 | xmlSetGenericErrorFunc(0, parseErrorFunc); |
| 96 | // We don't specify an encoding here. Neither Gecko nor WinIE respects |
| 97 | // the encoding specified in the HTTP headers. |
| 98 | xmlDocPtr doc = xmlReadMemory(data.data(), data.size(), (const char*)uri, 0, options); |
| 99 | xmlSetGenericErrorFunc(oldErrorContext, oldErrorFunc); |
| 100 | return doc; |
| 101 | } |
| 102 | case XSLT_LOAD_STYLESHEET: |
| 103 | return globalProcessor->xslStylesheet()->locateStylesheetSubResource(((xsltStylesheetPtr)ctxt)->doc, uri); |
| 104 | default: |
| 105 | break; |
| 106 | } |
| 107 | |
| 108 | return 0; |
| 109 | } |
| 110 | |
darin | f4b05b2 | 2006-07-10 05:20:17 +0000 | [diff] [blame] | 111 | static inline void setXSLTLoadCallBack(xsltDocLoaderFunc func, XSLTProcessor *processor, DocLoader *loader) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 112 | { |
| 113 | xsltSetLoaderFunc(func); |
| 114 | globalProcessor = processor; |
| 115 | globalDocLoader = loader; |
| 116 | } |
| 117 | |
| 118 | static int writeToQString(void *context, const char *buffer, int len) |
| 119 | { |
| 120 | DeprecatedString &resultOutput = *static_cast<DeprecatedString *>(context); |
| 121 | resultOutput += DeprecatedString::fromUtf8(buffer, len); |
| 122 | return len; |
| 123 | } |
| 124 | |
| 125 | static bool saveResultToString(xmlDocPtr resultDoc, xsltStylesheetPtr sheet, DeprecatedString &resultString) |
| 126 | { |
| 127 | xmlOutputBufferPtr outputBuf = xmlAllocOutputBuffer(0); |
| 128 | if (!outputBuf) |
| 129 | return false; |
| 130 | outputBuf->context = &resultString; |
| 131 | outputBuf->writecallback = writeToQString; |
| 132 | |
| 133 | int retval = xsltSaveResultTo(outputBuf, resultDoc, sheet); |
| 134 | xmlOutputBufferClose(outputBuf); |
| 135 | |
| 136 | return (retval >= 0); |
| 137 | } |
| 138 | |
darin | b3547a3 | 2006-09-06 04:40:44 +0000 | [diff] [blame] | 139 | static inline void transformTextStringToXHTMLDocumentString(String &text) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 140 | { |
| 141 | // Modify the output so that it is a well-formed XHTML document with a <pre> tag enclosing the text. |
| 142 | text.replace('&', "&"); |
| 143 | text.replace('<', "<"); |
| 144 | text = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
| 145 | "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n" |
| 146 | "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" |
| 147 | "<head><title/></head>\n" |
| 148 | "<body>\n" |
| 149 | "<pre>" + text + "</pre>\n" |
| 150 | "</body>\n" |
| 151 | "</html>\n"; |
| 152 | } |
| 153 | |
| 154 | static const char **xsltParamArrayFromParameterMap(XSLTProcessor::ParameterMap& parameters) |
| 155 | { |
| 156 | if (parameters.isEmpty()) |
| 157 | return 0; |
| 158 | |
| 159 | const char **parameterArray = (const char **)fastMalloc(((parameters.size() * 2) + 1) * sizeof(char *)); |
| 160 | |
| 161 | XSLTProcessor::ParameterMap::iterator end = parameters.end(); |
| 162 | unsigned index = 0; |
| 163 | for (XSLTProcessor::ParameterMap::iterator it = parameters.begin(); it != end; ++it) { |
andersca | 9cf539a | 2006-09-17 18:36:23 +0000 | [diff] [blame] | 164 | parameterArray[index++] = strdup(it->first.utf8()); |
| 165 | parameterArray[index++] = strdup(it->second.utf8()); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 166 | } |
| 167 | parameterArray[index] = 0; |
| 168 | |
| 169 | return parameterArray; |
| 170 | } |
| 171 | |
| 172 | static void freeXsltParamArray(const char **params) |
| 173 | { |
| 174 | const char **temp = params; |
| 175 | if (!params) |
| 176 | return; |
| 177 | |
| 178 | while (*temp) { |
| 179 | free((void *)*(temp++)); // strdup returns malloc'd blocks, so we have to use free() here |
| 180 | free((void *)*(temp++)); |
| 181 | } |
| 182 | fastFree(params); |
| 183 | } |
| 184 | |
| 185 | |
darin | b3547a3 | 2006-09-06 04:40:44 +0000 | [diff] [blame] | 186 | RefPtr<Document> XSLTProcessor::createDocumentFromSource(const DeprecatedString& sourceString, |
| 187 | const DeprecatedString& sourceEncoding, const DeprecatedString& sourceMIMEType, Node* sourceNode, FrameView* view) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 188 | { |
ggaren | aa01dc0 | 2006-03-29 00:21:31 +0000 | [diff] [blame] | 189 | RefPtr<Document> ownerDocument = sourceNode->document(); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 190 | bool sourceIsDocument = (sourceNode == ownerDocument.get()); |
darin | b3547a3 | 2006-09-06 04:40:44 +0000 | [diff] [blame] | 191 | String documentSource = sourceString; |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 192 | |
| 193 | RefPtr<Document> result; |
| 194 | if (sourceMIMEType == "text/html") |
| 195 | result = ownerDocument->implementation()->createHTMLDocument(view); |
| 196 | else { |
| 197 | result = ownerDocument->implementation()->createDocument(view); |
| 198 | if (sourceMIMEType == "text/plain") |
| 199 | transformTextStringToXHTMLDocumentString(documentSource); |
| 200 | } |
| 201 | |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 202 | // Before parsing, we need to save & detach the old document and get the new document |
| 203 | // in place. We have to do this only if we're rendering the result document. |
| 204 | if (view) { |
| 205 | view->clear(); |
| 206 | result->setTransformSourceDocument(view->frame()->document()); |
| 207 | view->frame()->setDocument(result.get()); |
| 208 | } |
| 209 | |
| 210 | result->open(); |
| 211 | if (sourceIsDocument) { |
| 212 | result->setURL(ownerDocument->URL()); |
| 213 | result->setBaseURL(ownerDocument->baseURL()); |
| 214 | } |
| 215 | result->determineParseMode(documentSource); // Make sure we parse in the correct mode. |
| 216 | |
ap | 41942e0 | 2006-09-01 19:36:06 +0000 | [diff] [blame] | 217 | RefPtr<Decoder> decoder = new Decoder(sourceMIMEType); |
darin | b3547a3 | 2006-09-06 04:40:44 +0000 | [diff] [blame] | 218 | decoder->setEncoding(sourceEncoding.isEmpty() ? UTF8Encoding() : TextEncoding(sourceEncoding), Decoder::EncodingFromXMLHeader); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 219 | result->setDecoder(decoder.get()); |
| 220 | |
| 221 | result->write(documentSource); |
| 222 | result->finishParsing(); |
| 223 | if (view) |
| 224 | view->frame()->checkCompleted(); |
| 225 | else |
| 226 | result->close(); // FIXME: Even viewless docs can load subresources. onload will fire too early. |
| 227 | // This is probably a bug in XMLHttpRequestObjects as well. |
| 228 | return result; |
| 229 | } |
| 230 | |
| 231 | static inline RefPtr<DocumentFragment> createFragmentFromSource(DeprecatedString sourceString, DeprecatedString sourceMIMEType, Node *sourceNode, Document *outputDoc) |
| 232 | { |
| 233 | RefPtr<DocumentFragment> fragment = new DocumentFragment(outputDoc); |
| 234 | |
| 235 | if (sourceMIMEType == "text/html") |
| 236 | parseHTMLDocumentFragment(sourceString, fragment.get()); |
| 237 | else if (sourceMIMEType == "text/plain") |
| 238 | fragment->addChild(new Text(outputDoc, sourceString)); |
| 239 | else { |
| 240 | bool successfulParse = parseXMLDocumentFragment(sourceString, fragment.get(), outputDoc->documentElement()); |
| 241 | if (!successfulParse) |
| 242 | return 0; |
| 243 | } |
| 244 | |
| 245 | // FIXME: Do we need to mess with URLs here? |
| 246 | |
| 247 | return fragment; |
| 248 | } |
| 249 | |
| 250 | static xsltStylesheetPtr xsltStylesheetPointer(RefPtr<XSLStyleSheet> &cachedStylesheet, Node *stylesheetRootNode) |
| 251 | { |
| 252 | if (!cachedStylesheet && stylesheetRootNode) { |
| 253 | cachedStylesheet = new XSLStyleSheet(stylesheetRootNode->parent() ? stylesheetRootNode->parent() : stylesheetRootNode); |
| 254 | cachedStylesheet->parseString(createMarkup(stylesheetRootNode)); |
| 255 | } |
| 256 | |
| 257 | if (!cachedStylesheet || !cachedStylesheet->document()) |
| 258 | return 0; |
| 259 | |
| 260 | return cachedStylesheet->compileStyleSheet(); |
| 261 | } |
| 262 | |
| 263 | static inline xmlDocPtr xmlDocPtrFromNode(Node *sourceNode, bool &shouldDelete) |
| 264 | { |
ggaren | aa01dc0 | 2006-03-29 00:21:31 +0000 | [diff] [blame] | 265 | RefPtr<Document> ownerDocument = sourceNode->document(); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 266 | bool sourceIsDocument = (sourceNode == ownerDocument.get()); |
| 267 | |
| 268 | xmlDocPtr sourceDoc = 0; |
| 269 | if (sourceIsDocument) |
| 270 | sourceDoc = (xmlDocPtr)ownerDocument->transformSource(); |
| 271 | if (!sourceDoc) { |
andersca | 06c0afdc | 2006-06-22 17:46:25 +0000 | [diff] [blame] | 272 | sourceDoc = (xmlDocPtr)xmlDocPtrForString(ownerDocument->docLoader(), createMarkup(sourceNode), sourceIsDocument ? ownerDocument->URL() : DeprecatedString()); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 273 | shouldDelete = (sourceDoc != 0); |
| 274 | } |
| 275 | return sourceDoc; |
| 276 | } |
| 277 | |
| 278 | static inline DeprecatedString resultMIMEType(xmlDocPtr resultDoc, xsltStylesheetPtr sheet) |
| 279 | { |
| 280 | // There are three types of output we need to be able to deal with: |
| 281 | // HTML (create an HTML document), XML (create an XML document), |
| 282 | // and text (wrap in a <pre> and create an XML document). |
| 283 | |
| 284 | const xmlChar *resultType = 0; |
| 285 | XSLT_GET_IMPORT_PTR(resultType, sheet, method); |
| 286 | if (resultType == 0 && resultDoc->type == XML_HTML_DOCUMENT_NODE) |
| 287 | resultType = (const xmlChar *)"html"; |
| 288 | |
| 289 | if (xmlStrEqual(resultType, (const xmlChar *)"html")) |
| 290 | return DeprecatedString("text/html"); |
| 291 | else if (xmlStrEqual(resultType, (const xmlChar *)"text")) |
| 292 | return DeprecatedString("text/plain"); |
| 293 | |
| 294 | return DeprecatedString("application/xml"); |
| 295 | } |
| 296 | |
| 297 | bool XSLTProcessor::transformToString(Node *sourceNode, DeprecatedString &mimeType, DeprecatedString &resultString, DeprecatedString &resultEncoding) |
| 298 | { |
ggaren | aa01dc0 | 2006-03-29 00:21:31 +0000 | [diff] [blame] | 299 | RefPtr<Document> ownerDocument = sourceNode->document(); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 300 | RefPtr<XSLStyleSheet> cachedStylesheet = m_stylesheet; |
| 301 | |
| 302 | setXSLTLoadCallBack(docLoaderFunc, this, ownerDocument->docLoader()); |
| 303 | xsltStylesheetPtr sheet = xsltStylesheetPointer(cachedStylesheet, m_stylesheetRootNode.get()); |
| 304 | if (!sheet) { |
| 305 | setXSLTLoadCallBack(0, 0, 0); |
| 306 | return false; |
| 307 | } |
| 308 | cachedStylesheet->clearDocuments(); |
| 309 | |
| 310 | bool success = false; |
| 311 | bool shouldFreeSourceDoc = false; |
| 312 | if (xmlDocPtr sourceDoc = xmlDocPtrFromNode(sourceNode, shouldFreeSourceDoc)) { |
ap | 3bc61e9 | 2006-08-22 04:32:02 +0000 | [diff] [blame] | 313 | // The XML declaration would prevent parsing the result as a fragment, and it's not needed even for documents, |
| 314 | // as the result of this function is always immediately parsed. |
| 315 | sheet->omitXmlDeclaration = true; |
| 316 | |
andersca | cae8bef | 2006-07-21 07:52:10 +0000 | [diff] [blame] | 317 | xsltTransformContextPtr transformContext = xsltNewTransformContext(sheet, sourceDoc); |
| 318 | |
| 319 | // This is a workaround for a bug in libxslt. |
| 320 | // The bug has been fixed in version 1.1.13, so once we ship that this can be removed. |
| 321 | if (transformContext->globalVars == NULL) |
| 322 | transformContext->globalVars = xmlHashCreate(20); |
| 323 | |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 324 | const char **params = xsltParamArrayFromParameterMap(m_parameters); |
andersca | cae8bef | 2006-07-21 07:52:10 +0000 | [diff] [blame] | 325 | xsltQuoteUserParams(transformContext, params); |
| 326 | xmlDocPtr resultDoc = xsltApplyStylesheetUser(sheet, sourceDoc, 0, 0, 0, transformContext); |
| 327 | |
| 328 | xsltFreeTransformContext(transformContext); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 329 | freeXsltParamArray(params); |
andersca | cae8bef | 2006-07-21 07:52:10 +0000 | [diff] [blame] | 330 | |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 331 | if (shouldFreeSourceDoc) |
| 332 | xmlFreeDoc(sourceDoc); |
| 333 | |
| 334 | if (success = saveResultToString(resultDoc, sheet, resultString)) { |
| 335 | mimeType = resultMIMEType(resultDoc, sheet); |
| 336 | resultEncoding = (char *)resultDoc->encoding; |
| 337 | } |
| 338 | xmlFreeDoc(resultDoc); |
| 339 | } |
| 340 | |
| 341 | setXSLTLoadCallBack(0, 0, 0); |
| 342 | xsltFreeStylesheet(sheet); |
| 343 | |
| 344 | return success; |
| 345 | } |
| 346 | |
| 347 | RefPtr<Document> XSLTProcessor::transformToDocument(Node *sourceNode) |
| 348 | { |
| 349 | DeprecatedString resultMIMEType; |
| 350 | DeprecatedString resultString; |
| 351 | DeprecatedString resultEncoding; |
| 352 | if (!transformToString(sourceNode, resultMIMEType, resultString, resultEncoding)) |
| 353 | return 0; |
| 354 | return createDocumentFromSource(resultString, resultEncoding, resultMIMEType, sourceNode); |
| 355 | } |
| 356 | |
| 357 | RefPtr<DocumentFragment> XSLTProcessor::transformToFragment(Node *sourceNode, Document *outputDoc) |
| 358 | { |
| 359 | DeprecatedString resultMIMEType; |
| 360 | DeprecatedString resultString; |
| 361 | DeprecatedString resultEncoding; |
| 362 | if (!transformToString(sourceNode, resultMIMEType, resultString, resultEncoding)) |
| 363 | return 0; |
| 364 | return createFragmentFromSource(resultString, resultMIMEType, sourceNode, outputDoc); |
| 365 | } |
| 366 | |
andersca | 9cf539a | 2006-09-17 18:36:23 +0000 | [diff] [blame] | 367 | void XSLTProcessor::setParameter(const String& namespaceURI, const String& localName, const String& value) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 368 | { |
| 369 | // FIXME: namespace support? |
| 370 | // should make a QualifiedName here but we'd have to expose the impl |
| 371 | m_parameters.set(localName, value); |
| 372 | } |
| 373 | |
andersca | 9cf539a | 2006-09-17 18:36:23 +0000 | [diff] [blame] | 374 | String XSLTProcessor::getParameter(const String& namespaceURI, const String& localName) const |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 375 | { |
| 376 | // FIXME: namespace support? |
| 377 | // should make a QualifiedName here but we'd have to expose the impl |
| 378 | return m_parameters.get(localName); |
| 379 | } |
| 380 | |
andersca | 9cf539a | 2006-09-17 18:36:23 +0000 | [diff] [blame] | 381 | void XSLTProcessor::removeParameter(const String& namespaceURI, const String& localName) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 382 | { |
| 383 | // FIXME: namespace support? |
| 384 | m_parameters.remove(localName); |
| 385 | } |
| 386 | |
weinig | f18aae3 | 2006-08-03 21:55:57 +0000 | [diff] [blame] | 387 | } // namespace WebCore |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 388 | |
hyatt | 5cc8ab8 | 2006-09-13 22:10:25 +0000 | [diff] [blame] | 389 | #endif // XSLT_SUPPORT |