whipped up a quick do-nothing (ie broken) implementation of element-available

This commit is contained in:
Jez Higgins 2010-02-21 18:35:58 +00:00
parent 53730337f7
commit 44b5d6ed3a
3 changed files with 36 additions and 10 deletions

View file

@ -189,6 +189,11 @@ private:
if(name == "system-property") if(name == "system-property")
return new SystemPropertyFunction(argExprs); return new SystemPropertyFunction(argExprs);
// element-available // element-available
if(name == "element-available")
{
std::vector<std::pair<std::string, std::string> > dummy;
return new ElementAvailableFunction(dummy, parser_.inScopeNamespaces(), argExprs);
}
// function-available // function-available
if(name == "function-available") if(name == "function-available")
return new FunctionAvailableFunction(validNames(), parser_.inScopeNamespaces(), argExprs); return new FunctionAvailableFunction(validNames(), parser_.inScopeNamespaces(), argExprs);

View file

@ -198,6 +198,31 @@ protected:
}; // SystemPropertyFunction }; // SystemPropertyFunction
// boolean element-available(string) // boolean element-available(string)
class ElementAvailableFunction : public Arabica::XPath::BooleanXPathFunction<std::string>
{
typedef Arabica::XPath::BooleanXPathFunction<std::string> baseT;
public:
ElementAvailableFunction(const std::vector<std::pair<std::string, std::string> >& names,
const std::map<std::string, std::string>& inscopeNamespaces,
const std::vector<Arabica::XPath::XPathExpression<std::string> >& args) :
Arabica::XPath::BooleanXPathFunction<std::string>(1, 1, args),
namespaces_(inscopeNamespaces),
elementNames_(names)
{
} // ElementAvailableFunction
protected:
virtual bool doEvaluate(const DOM::Node<std::string>& context,
const Arabica::XPath::ExecutionContext<std::string>& executionContext) const
{
return false;
} // doEvaluate
private:
std::vector<std::pair<std::string, std::string> > elementNames_;
const std::map<std::string, std::string> namespaces_;
}; // class ElementAvailableFunction
// boolean function-available(string) // boolean function-available(string)
class FunctionAvailableFunction : public Arabica::XPath::BooleanXPathFunction<std::string> class FunctionAvailableFunction : public Arabica::XPath::BooleanXPathFunction<std::string>
{ {
@ -207,8 +232,8 @@ public:
const std::map<std::string, std::string>& inscopeNamespaces, const std::map<std::string, std::string>& inscopeNamespaces,
const std::vector<Arabica::XPath::XPathExpression<std::string> >& args) : const std::vector<Arabica::XPath::XPathExpression<std::string> >& args) :
Arabica::XPath::BooleanXPathFunction<std::string>(1, 1, args), Arabica::XPath::BooleanXPathFunction<std::string>(1, 1, args),
functionNames_(names), namespaces_(inscopeNamespaces),
namespaces_(inscopeNamespaces) functionNames_(names)
{ {
Arabica::XPath::StandardXPathFunctionResolver<std::string> standardResolver; Arabica::XPath::StandardXPathFunctionResolver<std::string> standardResolver;
const std::vector<std::pair<std::string, std::string> > standardNames = standardResolver.validNames(); const std::vector<std::pair<std::string, std::string> > standardNames = standardResolver.validNames();
@ -230,8 +255,6 @@ protected:
private: private:
std::vector<std::pair<std::string, std::string> > functionNames_; std::vector<std::pair<std::string, std::string> > functionNames_;
const std::map<std::string, std::string> namespaces_; const std::map<std::string, std::string> namespaces_;
static Arabica::XPath::StandardXPathFunctionResolver<std::string> xpathStandardFunctionResolver;
}; // class FunctionAvailableFunction }; // class FunctionAvailableFunction
class UndefinedFunction : public Arabica::XPath::BooleanXPathFunction<std::string> class UndefinedFunction : public Arabica::XPath::BooleanXPathFunction<std::string>

View file

@ -686,10 +686,10 @@
<test-case id="XSLTFunctions__84054" compare="text"/> <test-case id="XSLTFunctions__84054" compare="text"/>
<test-case id="XSLTFunctions__84056" compare="text"/> <test-case id="XSLTFunctions__84056" compare="text"/>
<test-case id="XSLTFunctions__84058" compare="text"/> <test-case id="XSLTFunctions__84058" compare="text"/>
<test-case id="XSLTFunctions__84170" compiles="no"/> <test-case id="XSLTFunctions__84170" compare="text"/>
<test-case id="XSLTFunctions__84171" compiles="no"/> <test-case id="XSLTFunctions__84171" compare="text"/>
<test-case id="XSLTFunctions__84172" compiles="no"/> <test-case id="XSLTFunctions__84172" compare="text"/>
<test-case id="XSLTFunctions__84173" compiles="no"/> <test-case id="XSLTFunctions__84173" compare="text"/>
<test-case id="XSLTFunctions__84175" compare="text"/> <test-case id="XSLTFunctions__84175" compare="text"/>
<test-case id="XSLTFunctions__84415" compare="fragment"/> <test-case id="XSLTFunctions__84415" compare="fragment"/>
<test-case id="XSLTFunctions__84421" compare="fragment"/> <test-case id="XSLTFunctions__84421" compare="fragment"/>
@ -710,8 +710,6 @@
<test-case id="XSLTFunctions_DocumentFunctionWithEntityRef" runs="no"/> <test-case id="XSLTFunctions_DocumentFunctionWithEntityRef" runs="no"/>
<test-case id="XSLTFunctions_DocumentInUnion" compare="text"/> <test-case id="XSLTFunctions_DocumentInUnion" compare="text"/>
<test-case id="XSLTFunctions_DocumentInUnionWithDuplicateNodes" runs="no"/> <test-case id="XSLTFunctions_DocumentInUnionWithDuplicateNodes" runs="no"/>
<test-case id="XSLTFunctions_ElementAvailFunctionFalseTest" compiles="no"/>
<test-case id="XSLTFunctions_ElementAvailFunctionTrueTest" compiles="no"/>
<test-case id="XSLTFunctions_KeyFuncTestDescendantsNodeset" compiles="no"/> <test-case id="XSLTFunctions_KeyFuncTestDescendantsNodeset" compiles="no"/>
<test-case id="XSLTFunctions_TestIdFuncInComplexStruct" compiles="no"/> <test-case id="XSLTFunctions_TestIdFuncInComplexStruct" compiles="no"/>
<test-case id="XSLTFunctions_TestOfIdFunction" compiles="no"/> <test-case id="XSLTFunctions_TestOfIdFunction" compiles="no"/>