summaryrefslogtreecommitdiff
path: root/src/xpath.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2007-05-16 05:38:56 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 03:38:53 -0400
commit1134fc7eff7094700abf16c2e532d7c3c40ae68d (patch)
treec36cedd92745a45b03cdbb2c8e0aa0ddd37b6c50 /src/xpath.cc
parent51ef4d79143b6fb0e31aea9053996ec3a09e39a4 (diff)
downloadfork-ledger-1134fc7eff7094700abf16c2e532d7c3c40ae68d.tar.gz
fork-ledger-1134fc7eff7094700abf16c2e532d7c3c40ae68d.tar.bz2
fork-ledger-1134fc7eff7094700abf16c2e532d7c3c40ae68d.zip
The text() function now works.
Diffstat (limited to 'src/xpath.cc')
-rw-r--r--src/xpath.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/xpath.cc b/src/xpath.cc
index d56aa2f1..8594a283 100644
--- a/src/xpath.cc
+++ b/src/xpath.cc
@@ -2077,7 +2077,8 @@ void xpath_t::path_t::walk_elements(NodeType& start,
break;
default: {
- xpath_t final(name->compile(start, scope, true));
+ function_scope_t xpath_fscope(start, 0, 1, scope);
+ xpath_t final(name->compile(start, &xpath_fscope, true));
if (final.ptr->is_value()) {
value_t& result(final.ptr->as_value());
@@ -2100,17 +2101,21 @@ void xpath_t::path_t::walk_elements(NodeType& start,
walk_elements<NodeType>(*value.template as_xml_node<NodeType>(),
element, recurse, scope, func);
} else {
- if (element->kind > op_t::TERMINALS)
+ if (element->kind == op_t::O_FIND ||
+ element->kind == op_t::O_RFIND)
throw_(compile_error,
"Non-final expression in XPath selection returns non-node");
+
func(value);
}
}
}
else {
- if (element->kind > op_t::TERMINALS)
+ if (element->kind == op_t::O_FIND ||
+ element->kind == op_t::O_RFIND)
throw_(compile_error,
"Non-final expression in XPath selection returns non-node");
+
func(result);
}
} else {