зеркало из https://github.com/mozilla/pjs.git
not part of build, code by peterv, r=me. Getting xhtml output right. little fix for translate(), comment cleanup
This commit is contained in:
Родитель
4f9b6eec85
Коммит
6c1bd19571
|
@ -537,8 +537,22 @@ MBool String::isEqual(const String& data) const
|
|||
return MB_FALSE;
|
||||
else
|
||||
{
|
||||
if (ptrNSString->EqualsWithConversion((PRUnichar *)data.toUnicode(),
|
||||
PR_FALSE, data.length()) == PR_TRUE)
|
||||
if (ptrNSString->EqualsWithConversion(data.getConstNSString()) == PR_TRUE)
|
||||
return MB_TRUE;
|
||||
else
|
||||
return MB_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
MBool String::isEqualIgnoreCase(const String& data) const
|
||||
{
|
||||
if (this == &data)
|
||||
return MB_TRUE;
|
||||
else if (length() != data.length())
|
||||
return MB_FALSE;
|
||||
else
|
||||
{
|
||||
if (ptrNSString->EqualsIgnoreCase(data.getConstNSString()) == PR_TRUE)
|
||||
return MB_TRUE;
|
||||
else
|
||||
return MB_FALSE;
|
||||
|
|
|
@ -207,6 +207,9 @@ class String : public MITREObject
|
|||
|
||||
virtual MBool isEqual(const String& data) const; //Check equality between
|
||||
//strings
|
||||
#ifdef MOZ_XSL
|
||||
virtual MBool isEqualIgnoreCase(const String& data) const;
|
||||
#endif
|
||||
|
||||
//Returns index of last occurrence of data
|
||||
virtual Int32 lastIndexOf(UNICODE_CHAR data) const;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Peter Van der Beken, Peter.VanderBeken@pandora.be
|
||||
* -- original author.
|
||||
*
|
||||
* $Id: NamespaceResolver.h,v 1.3 2000-11-07 10:47:17 kvisco%ziplink.net Exp $
|
||||
* $Id: NamespaceResolver.h,v 1.4 2001-01-22 20:23:43 axel%pike.org Exp $
|
||||
*/
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@ public:
|
|||
/**
|
||||
* Returns the namespace URI for the given name
|
||||
**/
|
||||
virtual void getNameSpaceURI(const String& name, String& nameSpaceURI) = 0;
|
||||
virtual void getResultNameSpaceURI(const String& name, String& nameSpaceURI) = 0;
|
||||
|
||||
/**
|
||||
* Returns the namespace URI for the given namespace prefix
|
||||
|
|
|
@ -21,13 +21,13 @@
|
|||
* Keith Visco
|
||||
* -- original author.
|
||||
*
|
||||
* $Id: XMLDOMUtils.cpp,v 1.9 2001-01-22 09:32:40 kvisco%ziplink.net Exp $
|
||||
* $Id: XMLDOMUtils.cpp,v 1.10 2001-01-22 20:23:44 axel%pike.org Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* XMLDOMUtils
|
||||
* @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
|
||||
* @version $Revision: 1.9 $ $Date: 2001-01-22 09:32:40 $
|
||||
* @version $Revision: 1.10 $ $Date: 2001-01-22 20:23:44 $
|
||||
**/
|
||||
|
||||
#include "XMLDOMUtils.h"
|
||||
|
@ -86,7 +86,7 @@ Node* XMLDOMUtils::copyNode(Node* node, Document* owner, NamespaceResolver* reso
|
|||
#ifdef MOZ_XSL
|
||||
String name, nameSpaceURI;
|
||||
name = element->getNodeName();
|
||||
resolver->getNameSpaceURI(name, nameSpaceURI);
|
||||
resolver->getResultNameSpaceURI(name, nameSpaceURI);
|
||||
Element* newElement = owner->createElementNS(nameSpaceURI, name);
|
||||
#else
|
||||
Element* newElement = owner->createElement(element->getNodeName());
|
||||
|
@ -98,7 +98,7 @@ Node* XMLDOMUtils::copyNode(Node* node, Document* owner, NamespaceResolver* reso
|
|||
for ( i = 0; i < attList->getLength(); i++ ) {
|
||||
Attr* attr = (Attr*) attList->item(i);
|
||||
#ifdef MOZ_XSL
|
||||
resolver->getNameSpaceURI(attr->getName(), nameSpaceURI);
|
||||
resolver->getResultNameSpaceURI(attr->getName(), nameSpaceURI);
|
||||
newElement->setAttributeNS(nameSpaceURI, attr->getName(), attr->getValue());
|
||||
#else
|
||||
newElement->setAttribute(attr->getName(), attr->getValue());
|
||||
|
|
|
@ -130,7 +130,7 @@ Element* Document::getDocumentElement()
|
|||
}
|
||||
|
||||
/**
|
||||
* Call nsIDOMDocument::GetDocumentElement to get the document's DocumentType.
|
||||
* Call nsIDOMDocument::GetDoctype to get the document's DocumentType.
|
||||
*
|
||||
* @return the DocumentType
|
||||
*/
|
||||
|
|
|
@ -51,7 +51,7 @@ NamedNodeMap::~NamedNodeMap()
|
|||
/**
|
||||
* Wrap a different Mozilla object with this wrapper.
|
||||
*
|
||||
* @param aNamedNodeMap the nsIDOMNodeList you want to wrap
|
||||
* @param aNamedNodeMap the nsIDOMNamedNodeMap you want to wrap
|
||||
*/
|
||||
void NamedNodeMap::setNSObj(nsIDOMNamedNodeMap* aNamedNodeMap)
|
||||
{
|
||||
|
|
|
@ -21,14 +21,14 @@
|
|||
* Keith Visco, kvisco@ziplink.net
|
||||
* -- original author.
|
||||
*
|
||||
* $Id: StringFunctionCall.cpp,v 1.6 2001-01-12 20:06:37 axel%pike.org Exp $
|
||||
* $Id: StringFunctionCall.cpp,v 1.7 2001-01-22 20:23:47 axel%pike.org Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* StringFunctionCall
|
||||
* A representation of the XPath String funtions
|
||||
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
|
||||
* @version $Revision: 1.6 $ $Date: 2001-01-12 20:06:37 $
|
||||
* @version $Revision: 1.7 $ $Date: 2001-01-22 20:23:47 $
|
||||
**/
|
||||
|
||||
#include "FunctionLib.h"
|
||||
|
@ -254,8 +254,8 @@ ExprResult* StringFunctionCall::evaluate(Node* context, ContextState* cs) {
|
|||
for (i = 0; i < size; i++) {
|
||||
Int32 idx = oldChars.indexOf(chars[i]);
|
||||
if (idx >= 0) {
|
||||
UNICODE_CHAR nchar = newChars.charAt(idx);
|
||||
if (nchar != -1) src.append(nchar);
|
||||
if (idx<newChars.length())
|
||||
src.append(newChars.charAt(idx));
|
||||
}
|
||||
else src.append(chars[i]);
|
||||
}
|
||||
|
|
|
@ -25,13 +25,13 @@
|
|||
* -- added code in ::resolveFunctionCall to support the
|
||||
* document() function.
|
||||
*
|
||||
* $Id: ProcessorState.cpp,v 1.15 2001-01-22 09:39:54 kvisco%ziplink.net Exp $
|
||||
* $Id: ProcessorState.cpp,v 1.16 2001-01-22 20:23:50 axel%pike.org Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implementation of ProcessorState
|
||||
* Much of this code was ported from XSL:P
|
||||
* @version $Revision: 1.15 $ $Date: 2001-01-22 09:39:54 $
|
||||
* @version $Revision: 1.16 $ $Date: 2001-01-22 20:23:50 $
|
||||
**/
|
||||
|
||||
#include "ProcessorState.h"
|
||||
|
@ -191,6 +191,9 @@ void ProcessorState::addTemplate(Element* xslTemplate) {
|
|||
MBool ProcessorState::addToResultTree(Node* node) {
|
||||
|
||||
Node* current = nodeStack->peek();
|
||||
#ifdef MOZ_XSL
|
||||
String nameSpaceURI, name, localName;
|
||||
#endif
|
||||
|
||||
switch (node->getNodeType()) {
|
||||
|
||||
|
@ -200,9 +203,8 @@ MBool ProcessorState::addToResultTree(Node* node) {
|
|||
Element* element = (Element*)current;
|
||||
Attr* attr = (Attr*)node;
|
||||
#ifdef MOZ_XSL
|
||||
String nameSpaceURI, name;
|
||||
name = attr->getName();
|
||||
getNameSpaceURI(name, nameSpaceURI);
|
||||
getResultNameSpaceURI(name, nameSpaceURI);
|
||||
// XXX HACK (pvdb) Workaround for BUG 51656 Html rendered as xhtml
|
||||
if (getOutputFormat()->isHTMLOutput()) {
|
||||
name.toLowerCase();
|
||||
|
@ -227,6 +229,19 @@ MBool ProcessorState::addToResultTree(Node* node) {
|
|||
current->appendChild(wrapper);
|
||||
current = wrapper;
|
||||
}
|
||||
#ifdef MOZ_XSL
|
||||
else {
|
||||
// Checking if we should set the output method to HTML
|
||||
name = node->getNodeName();
|
||||
XMLUtils::getLocalPart(name, localName);
|
||||
if (localName.isEqualIgnoreCase(HTML)) {
|
||||
setOutputMethod(HTML);
|
||||
// XXX HACK (pvdb) Workaround for BUG 51656
|
||||
// Html rendered as xhtml
|
||||
name.toLowerCase();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
current->appendChild(node);
|
||||
break;
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
* Olivier Gerardin
|
||||
* -- Changed behavior of passing parameters to templates
|
||||
*
|
||||
* $Id: XSLTProcessor.cpp,v 1.30 2001-01-22 15:53:06 axel%pike.org Exp $
|
||||
* $Id: XSLTProcessor.cpp,v 1.31 2001-01-22 20:23:50 axel%pike.org Exp $
|
||||
*/
|
||||
|
||||
#include "XSLTProcessor.h"
|
||||
|
@ -53,7 +53,7 @@
|
|||
/**
|
||||
* XSLTProcessor is a class for Processing XSL styelsheets
|
||||
* @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
|
||||
* @version $Revision: 1.30 $ $Date: 2001-01-22 15:53:06 $
|
||||
* @version $Revision: 1.31 $ $Date: 2001-01-22 20:23:50 $
|
||||
**/
|
||||
|
||||
/**
|
||||
|
@ -1639,10 +1639,7 @@ void XSLTProcessor::xslCopy(Node* node, Element* action, ProcessorState* ps) {
|
|||
}
|
||||
|
||||
String nameSpaceURI;
|
||||
String prefix;
|
||||
int idx = nodeName.indexOf(':');
|
||||
if (idx >= 0) nodeName.subString(0, idx, prefix);
|
||||
XMLDOMUtils::getNameSpace(prefix, element, nameSpaceURI);
|
||||
ps->getResultNameSpaceURI(nodeName, nameSpaceURI);
|
||||
// XXX HACK (pvdb) Workaround for BUG 51656 Html rendered as xhtml
|
||||
if (ps->getOutputFormat()->isHTMLOutput()) {
|
||||
nodeName.toLowerCase();
|
||||
|
|
Загрузка…
Ссылка в новой задаче