From 44b5d6ed3a4b127d17f694eeca3837fbf8865875 Mon Sep 17 00:00:00 2001 From: Jez Higgins Date: Sun, 21 Feb 2010 18:35:58 +0000 Subject: [PATCH] whipped up a quick do-nothing (ie broken) implementation of element-available --- .../XSLT/impl/xslt_compilation_context.hpp | 5 +++ include/XSLT/impl/xslt_functions.hpp | 31 ++++++++++++++++--- .../TESTS/arabica-expected-fails.xml | 10 +++--- 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/include/XSLT/impl/xslt_compilation_context.hpp b/include/XSLT/impl/xslt_compilation_context.hpp index 11e810d7..4fc5fa1e 100644 --- a/include/XSLT/impl/xslt_compilation_context.hpp +++ b/include/XSLT/impl/xslt_compilation_context.hpp @@ -189,6 +189,11 @@ private: if(name == "system-property") return new SystemPropertyFunction(argExprs); // element-available + if(name == "element-available") + { + std::vector > dummy; + return new ElementAvailableFunction(dummy, parser_.inScopeNamespaces(), argExprs); + } // function-available if(name == "function-available") return new FunctionAvailableFunction(validNames(), parser_.inScopeNamespaces(), argExprs); diff --git a/include/XSLT/impl/xslt_functions.hpp b/include/XSLT/impl/xslt_functions.hpp index 90878252..a36f481e 100644 --- a/include/XSLT/impl/xslt_functions.hpp +++ b/include/XSLT/impl/xslt_functions.hpp @@ -198,6 +198,31 @@ protected: }; // SystemPropertyFunction // boolean element-available(string) +class ElementAvailableFunction : public Arabica::XPath::BooleanXPathFunction +{ + typedef Arabica::XPath::BooleanXPathFunction baseT; +public: + ElementAvailableFunction(const std::vector >& names, + const std::map& inscopeNamespaces, + const std::vector >& args) : + Arabica::XPath::BooleanXPathFunction(1, 1, args), + namespaces_(inscopeNamespaces), + elementNames_(names) + { + } // ElementAvailableFunction + +protected: + virtual bool doEvaluate(const DOM::Node& context, + const Arabica::XPath::ExecutionContext& executionContext) const + { + return false; + } // doEvaluate + +private: + std::vector > elementNames_; + const std::map namespaces_; +}; // class ElementAvailableFunction + // boolean function-available(string) class FunctionAvailableFunction : public Arabica::XPath::BooleanXPathFunction { @@ -207,8 +232,8 @@ public: const std::map& inscopeNamespaces, const std::vector >& args) : Arabica::XPath::BooleanXPathFunction(1, 1, args), - functionNames_(names), - namespaces_(inscopeNamespaces) + namespaces_(inscopeNamespaces), + functionNames_(names) { Arabica::XPath::StandardXPathFunctionResolver standardResolver; const std::vector > standardNames = standardResolver.validNames(); @@ -230,8 +255,6 @@ protected: private: std::vector > functionNames_; const std::map namespaces_; - - static Arabica::XPath::StandardXPathFunctionResolver xpathStandardFunctionResolver; }; // class FunctionAvailableFunction class UndefinedFunction : public Arabica::XPath::BooleanXPathFunction diff --git a/tests/XSLT/testsuite/TESTS/arabica-expected-fails.xml b/tests/XSLT/testsuite/TESTS/arabica-expected-fails.xml index 0026e478..0dca4a55 100644 --- a/tests/XSLT/testsuite/TESTS/arabica-expected-fails.xml +++ b/tests/XSLT/testsuite/TESTS/arabica-expected-fails.xml @@ -686,10 +686,10 @@ - - - - + + + + @@ -710,8 +710,6 @@ - -