зеркало из https://github.com/mozilla/pjs.git
bug 78127, xsl:choose and stacks, code by sicking@bigfoot.com, r=keith, r/a=peterv, sr=shaver
This commit is contained in:
Родитель
d3d7ce1d90
Коммит
eb8d25597d
|
@ -38,7 +38,7 @@
|
|||
* Olivier Gerardin
|
||||
* -- Changed behavior of passing parameters to templates
|
||||
*
|
||||
* $Id: XSLTProcessor.cpp,v 1.45 2001-05-14 14:22:49 axel%pike.org Exp $
|
||||
* $Id: XSLTProcessor.cpp,v 1.46 2001-05-15 06:13:02 axel%pike.org Exp $
|
||||
*/
|
||||
|
||||
#include "XSLTProcessor.h"
|
||||
|
@ -72,7 +72,7 @@
|
|||
/**
|
||||
* XSLTProcessor is a class for Processing XSL stylesheets
|
||||
* @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
|
||||
* @version $Revision: 1.45 $ $Date: 2001-05-14 14:22:49 $
|
||||
* @version $Revision: 1.46 $ $Date: 2001-05-15 06:13:02 $
|
||||
**/
|
||||
|
||||
/**
|
||||
|
@ -729,7 +729,7 @@ void XSLTProcessor::bindVariable
|
|||
* Returns the type of Element represented by the given name
|
||||
* @return the XSLType represented by the given element name
|
||||
**/
|
||||
short XSLTProcessor::getElementType(String& name, ProcessorState* ps) {
|
||||
short XSLTProcessor::getElementType(const String& name, ProcessorState* ps) {
|
||||
|
||||
|
||||
String namePart;
|
||||
|
@ -1007,30 +1007,30 @@ void XSLTProcessor::processAction
|
|||
case XSLType::CHOOSE :
|
||||
{
|
||||
Node* tmp = actionElement->getFirstChild();
|
||||
Element* xslTemplate = 0;
|
||||
while (tmp) {
|
||||
if ( tmp->getNodeType() != Node::ELEMENT_NODE ) {
|
||||
tmp = tmp->getNextSibling();
|
||||
continue;
|
||||
}
|
||||
xslTemplate = (Element*)tmp;
|
||||
String nodeName = xslTemplate->getNodeName();
|
||||
switch ( getElementType(nodeName, ps) ) {
|
||||
case XSLType::WHEN :
|
||||
{
|
||||
expr = ps->getExpr(xslTemplate->getAttribute(TEST_ATTR));
|
||||
ExprResult* result = expr->evaluate(node, ps);
|
||||
if ( result->booleanValue() ) {
|
||||
processTemplate(node, xslTemplate, ps);
|
||||
return;
|
||||
MBool caseFound = MB_FALSE;
|
||||
Element* xslTemplate;
|
||||
while (!caseFound && tmp) {
|
||||
if ( tmp->getNodeType() == Node::ELEMENT_NODE ) {
|
||||
xslTemplate = (Element*)tmp;
|
||||
switch (getElementType(xslTemplate->getNodeName(),
|
||||
ps)) {
|
||||
case XSLType::WHEN :
|
||||
{
|
||||
expr = ps->getExpr(xslTemplate->getAttribute(TEST_ATTR));
|
||||
ExprResult* result = expr->evaluate(node, ps);
|
||||
if ( result->booleanValue() ) {
|
||||
processTemplate(node, xslTemplate, ps);
|
||||
caseFound = MB_TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case XSLType::OTHERWISE:
|
||||
processTemplate(node, xslTemplate, ps);
|
||||
caseFound = MB_TRUE;
|
||||
break;
|
||||
default: //-- invalid xsl:choose child
|
||||
break;
|
||||
}
|
||||
case XSLType::OTHERWISE:
|
||||
processTemplate(node, xslTemplate, ps);
|
||||
return; //-- important to break out of everything
|
||||
default: //-- invalid xsl:choose child
|
||||
break;
|
||||
}
|
||||
tmp = tmp->getNextSibling();
|
||||
} //-- end for-each child of xsl:choose
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* Keith Visco, kvisco@ziplink.net
|
||||
* -- original author.
|
||||
*
|
||||
* $Id: XSLTProcessor.h,v 1.16 2001-05-12 12:00:43 peterv%netscape.com Exp $
|
||||
* $Id: XSLTProcessor.h,v 1.17 2001-05-15 06:13:02 axel%pike.org Exp $
|
||||
*/
|
||||
|
||||
|
||||
|
@ -63,7 +63,7 @@
|
|||
/**
|
||||
* A class for Processing XSL Stylesheets
|
||||
* @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
|
||||
* @version $Revision: 1.16 $ $Date: 2001-05-12 12:00:43 $
|
||||
* @version $Revision: 1.17 $ $Date: 2001-05-15 06:13:02 $
|
||||
**/
|
||||
class XSLTProcessor
|
||||
#ifdef MOZ_XSL
|
||||
|
@ -268,7 +268,7 @@ private:
|
|||
* Looks up the given XSLType with the given name
|
||||
* The ProcessorState is used to get the current XSLT namespace
|
||||
**/
|
||||
short getElementType(String& name, ProcessorState* ps);
|
||||
short getElementType(const String& name, ProcessorState* ps);
|
||||
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче