From e797b08a75c182c4d8fe79e91099481b0ced57d3 Mon Sep 17 00:00:00 2001 From: "kvisco%ziplink.net" Date: Thu, 17 Feb 2000 03:29:30 +0000 Subject: [PATCH] updated XSLT namespace git-svn-id: svn://10.0.0.236/trunk@61176 18797224-902f-48f8-a5cc-f745e15eee43 --- .../transformiix/source/xsl/Names.cpp | 18 ++--- .../source/xsl/ProcessorState.cpp | 28 ++++---- .../transformiix/source/xsl/XSLProcessor.cpp | 67 ++++++++++--------- 3 files changed, 60 insertions(+), 53 deletions(-) diff --git a/mozilla/extensions/transformiix/source/xsl/Names.cpp b/mozilla/extensions/transformiix/source/xsl/Names.cpp index e0b7ccb6039..bf5f47e6846 100644 --- a/mozilla/extensions/transformiix/source/xsl/Names.cpp +++ b/mozilla/extensions/transformiix/source/xsl/Names.cpp @@ -3,32 +3,32 @@ * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/MPL/ - * + * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. - * + * * The Original Code is TransforMiiX XSLT processor. - * + * * The Initial Developer of the Original Code is The MITRE Corporation. * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * * Portions created by Keith Visco as a Non MITRE employee, * (C) 1999 Keith Visco. All Rights Reserved. - * - * Contributor(s): + * + * Contributor(s): * Keith Visco, kvisco@ziplink.net * -- original author. * - * $Id: Names.cpp,v 1.3 1999-11-18 04:39:55 kvisco%ziplink.net Exp $ + * $Id: Names.cpp,v 1.4 2000-02-17 03:29:28 kvisco%ziplink.net Exp $ */ /** * XSL names used throughout the XSLProcessor. * Probably should be wrapped in a Namespace * @author Keith Visco - * @version $Revision: 1.3 $ $Date: 1999-11-18 04:39:55 $ + * @version $Revision: 1.4 $ $Date: 2000-02-17 03:29:28 $ **/ #include "Names.h" @@ -39,7 +39,7 @@ const String STYLESHEET_PI = "xml-stylesheet"; const String STYLESHEET_PI_OLD = "xml:stylesheet"; const String XML_SPACE = "xml:space"; const String XSL_MIME_TYPE = "text/xsl"; -const String XSLT_NS = "http://www.w3.org/XSL/Transform/"; +const String XSLT_NS = "http://www.w3.org/1999/XSL/Transform"; //-- Elements const String APPLY_IMPORTS = "apply-imports"; @@ -92,7 +92,7 @@ const String MEDIA_TYPE_ATTR = "media-type"; const String MODE_ATTR = "mode"; const String NAME_ATTR = "name"; const String NAMESPACE_ATTR = "namespace"; -const String OMIT_XMLDECL_ATTR = "omit-xml-declaration"; +const String OMIT_XMLDECL_ATTR = "omit-xml-declaration"; const String PRIORITY_ATTR = "priority"; const String SELECT_ATTR = "select"; const String STANDALONE = "standalone"; diff --git a/mozilla/extensions/transformiix/source/xsl/ProcessorState.cpp b/mozilla/extensions/transformiix/source/xsl/ProcessorState.cpp index 16f59585452..6c4029d5d08 100644 --- a/mozilla/extensions/transformiix/source/xsl/ProcessorState.cpp +++ b/mozilla/extensions/transformiix/source/xsl/ProcessorState.cpp @@ -3,32 +3,32 @@ * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/MPL/ - * + * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. - * + * * The Original Code is TransforMiiX XSLT processor. - * + * * The Initial Developer of the Original Code is The MITRE Corporation. * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * * Portions created by Keith Visco as a Non MITRE employee, * (C) 1999 Keith Visco. All Rights Reserved. - * - * Contributor(s): + * + * Contributor(s): * Keith Visco, kvisco@ziplink.net * -- original author. * - * $Id: ProcessorState.cpp,v 1.3 1999-11-18 04:39:57 kvisco%ziplink.net Exp $ + * $Id: ProcessorState.cpp,v 1.4 2000-02-17 03:29:29 kvisco%ziplink.net Exp $ */ /** * Implementation of ProcessorState * This code was ported from XSL:P * @author Keith Visco - * @version $Revision: 1.3 $ $Date: 1999-11-18 04:39:57 $ + * @version $Revision: 1.4 $ $Date: 2000-02-17 03:29:29 $ **/ #include "ProcessorState.h" @@ -67,10 +67,10 @@ ProcessorState::~ProcessorState() { StringListIterator iter = keys->iterator(); while (iter.hasNext()) { String* key = iter.next(); - MITREObjectWrapper* objWrapper + MITREObjectWrapper* objWrapper = (MITREObjectWrapper*)includes.remove(*key); delete (Document*)objWrapper->object; - delete objWrapper; + delete objWrapper; } delete keys; @@ -312,7 +312,7 @@ const String& ProcessorState::getDocumentBase() { * includes and imports lists **/ void ProcessorState::getDocumentHref - (Document* xslDocument, String& documentBase) + (Document* xslDocument, String& documentBase) { documentBase.clear(); @@ -322,7 +322,7 @@ void ProcessorState::getDocumentHref StringListIterator& iter = keys->iterator(); while (iter.hasNext()) { String* key = iter.next(); - MITREObjectWrapper* objWrapper + MITREObjectWrapper* objWrapper = (MITREObjectWrapper*)includes.get(*key); if (xslDocument == objWrapper->object) { documentBase.append(*key); @@ -335,7 +335,7 @@ void ProcessorState::getDocumentHref /** * @return the included xsl document that was associated with the - * given href, or null if no document is found + * given href, or null if no document is found **/ Document* ProcessorState::getInclude(const String& href) { MITREObjectWrapper* objWrapper = (MITREObjectWrapper*)includes.get(href); @@ -471,7 +471,7 @@ void ProcessorState::stripSpace(String& names) { //--------------------------------------------------/ /** - * Returns the parent of the given Node. This method is needed + * Returns the parent of the given Node. This method is needed * beacuse with the DOM some nodes such as Attr do not have parents * @param node the Node to find the parent of * @return the parent of the given Node, or null if not found @@ -674,7 +674,7 @@ void ProcessorState::initialize() { } } else if ( attName.isEqual(RESULT_NS_ATTR) ) { - if (attValue.length() > 0) { + if (attValue.length() > 0) { if ( attValue.indexOf(HTML_NS) == 0 ) { format.setMethod("html"); } diff --git a/mozilla/extensions/transformiix/source/xsl/XSLProcessor.cpp b/mozilla/extensions/transformiix/source/xsl/XSLProcessor.cpp index 87b687054bd..32f60751df8 100644 --- a/mozilla/extensions/transformiix/source/xsl/XSLProcessor.cpp +++ b/mozilla/extensions/transformiix/source/xsl/XSLProcessor.cpp @@ -3,21 +3,21 @@ * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/MPL/ - * + * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. - * + * * The Original Code is TransforMiiX XSLT processor. - * + * * The Initial Developer of the Original Code is The MITRE Corporation. * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * * Portions created by Keith Visco as a Non MITRE employee, * (C) 1999 Keith Visco. All Rights Reserved. - * - * Contributor(s): + * + * Contributor(s): * Keith Visco, kvisco@ziplink.net * -- original author. * Bob Miller, kbob@oblix.com @@ -25,7 +25,7 @@ * Pierre Phaneuf, pp@ludusdesign.com * -- fixed some XPCOM usage. * - * $Id: XSLProcessor.cpp,v 1.6 2000-01-11 20:47:47 pp%ludusdesign.com Exp $ + * $Id: XSLProcessor.cpp,v 1.7 2000-02-17 03:29:30 kvisco%ziplink.net Exp $ */ #include "XSLProcessor.h" @@ -38,7 +38,7 @@ /** * XSLProcessor is a class for Processing XSL styelsheets * @author Keith Visco - * @version $Revision: 1.6 $ $Date: 2000-01-11 20:47:47 $ + * @version $Revision: 1.7 $ $Date: 2000-02-17 03:29:30 $ **/ /** @@ -109,7 +109,7 @@ XSLProcessor::Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult) { if (aOuter) return NS_ERROR_NO_AGGREGATION; - + XSLProcessor* xslp = new XSLProcessor(); if (xslp == NULL) return NS_ERROR_OUT_OF_MEMORY; @@ -140,7 +140,7 @@ void XSLProcessor::addErrorObserver(ErrorObserver& errorObserver) { #ifndef MOZILLA void XSLProcessor::print - (Document& document, OutputFormat* format, ostream& out) + (Document& document, OutputFormat* format, ostream& out) { XMLPrinter* xmlPrinter = 0; @@ -156,7 +156,7 @@ void XSLProcessor::print } else { //-- try to determine output method - Element* element = document.getDocumentElement(); + Element* element = document.getDocumentElement(); String name; if (element) name = element->getNodeName(); name.toUpperCase(); @@ -370,7 +370,7 @@ Document* XSLProcessor::process(istream& xmlInput, String& documentBase) { * Processes the Top level elements for an XSL stylesheet **/ void XSLProcessor::processTopLevel - (Document* xslDocument, ProcessorState* ps) + (Document* xslDocument, ProcessorState* ps) { if (!xslDocument) return; @@ -401,7 +401,7 @@ void XSLProcessor::processTopLevel break; } - ExprResult* exprResult + ExprResult* exprResult = processVariable(node, element, ps); bindVariable(name, exprResult, MB_TRUE, ps); @@ -420,21 +420,21 @@ void XSLProcessor::processTopLevel break; } - //-- get document base + //-- get document base String documentBase; - String currentHref; + String currentHref; //ps->getDocumentHref(element->getOwnerDocument(), // currentHref); if (currentHref.length() == 0) { documentBase.append(ps->getDocumentBase()); } - else { + else { URIUtils::getDocumentBase(currentHref, documentBase); } String errMsg; - istream* xslInput + istream* xslInput = URIUtils::getInputStream(href,documentBase,errMsg); Document* xslDoc = 0; XMLParser xmlParser; @@ -466,7 +466,7 @@ void XSLProcessor::processTopLevel attValue = element->getAttribute(VERSION_ATTR); if (attValue.length() > 0) format->setVersion(attValue); - + attValue = element->getAttribute(ENCODING_ATTR); if (attValue.length() > 0) format->setEncoding(attValue); @@ -477,11 +477,11 @@ void XSLProcessor::processTopLevel } attValue = element->getAttribute(DOCTYPE_PUBLIC_ATTR); - if (attValue.length() > 0) + if (attValue.length() > 0) format->setDoctypePublic(attValue); attValue = element->getAttribute(DOCTYPE_SYSTEM_ATTR); - if (attValue.length() > 0) + if (attValue.length() > 0) format->setDoctypeSystem(attValue); break; @@ -538,7 +538,7 @@ void XSLProcessor::processTopLevel * and returns the result tree **/ Document* XSLProcessor::process - (Document& xmlDocument, Document& xslDocument, String& documentBase) + (Document& xmlDocument, Document& xslDocument, String& documentBase) { Document* result = new Document(); @@ -557,7 +557,7 @@ Document* XSLProcessor::process //-------------------------------------------------------/ //- index templates and process top level xsl elements -/ //-------------------------------------------------------/ - + processTopLevel(&xslDocument, &ps); //----------------------------------------/ @@ -575,10 +575,10 @@ Document* XSLProcessor::process * and prints the results to the given ostream argument **/ void XSLProcessor::process - ( Document& xmlDocument, - Document& xslDocument, - ostream& out, - String& documentBase ) + ( Document& xmlDocument, + Document& xslDocument, + ostream& out, + String& documentBase ) { @@ -598,7 +598,7 @@ void XSLProcessor::process //-------------------------------------------------------/ //- index templates and process top level xsl elements -/ //-------------------------------------------------------/ - + processTopLevel(&xslDocument, &ps); //----------------------------------------/ @@ -621,7 +621,7 @@ void XSLProcessor::process * will not close the ostream argument **/ void XSLProcessor::process - (istream& xmlInput, ostream& out, String& documentBase) + (istream& xmlInput, ostream& out, String& documentBase) { XMLParser xmlParser; @@ -662,7 +662,7 @@ void XSLProcessor::process * will not close the ostream argument **/ void XSLProcessor::process - (istream& xmlInput, istream& xslInput, ostream& out, String& documentBase) + (istream& xmlInput, istream& xslInput, ostream& out, String& documentBase) { //-- read in XML Document XMLParser xmlParser; @@ -1106,7 +1106,14 @@ void XSLProcessor::processAction case XSLType::MESSAGE : { String message; - XMLDOMUtils::getNodeValue(actionElement, &message); + + DocumentFragment* dfrag = resultDoc->createDocumentFragment(); + ps->getNodeStack()->push(dfrag); + processTemplate(node, actionElement, ps); + ps->getNodeStack()->pop(); + XMLDOMUtils::getNodeValue(dfrag, &message); + delete dfrag; + //-- we should add a MessageObserver class cout << "xsl:message - "<< message << endl; break; @@ -1525,7 +1532,7 @@ void XSLProcessor::xslCopyOf(ExprResult* exprResult, ProcessorState* ps) { #ifdef MOZILLA NS_IMETHODIMP -XSLProcessor::TransformDocument(nsIDOMElement* aSourceDOM, +XSLProcessor::TransformDocument(nsIDOMElement* aSourceDOM, nsIDOMElement* aStyleDOM, nsIDOMDocument* aOutputDoc, nsIObserver* aObserver)