void sort(const DOM::Node<std::string>& node, Arabica::XPath::NodeSet<std::string>& nodes, ExecutionContext& context) const { if(!sort_) { if(!nodes.forward()) nodes.to_document_order(); return; } sort_->set_context(node, context); std::stable_sort(nodes.begin(), nodes.end(), SortP(*sort_)); } // sort
Arabica::XPath::NodeSet<std::string> nodeSetUnion(const std::string& keyClarkName, const Arabica::XPath::NodeSet<std::string> nodes, const Arabica::XPath::ExecutionContext<std::string>& executionContext) const { Arabica::XPath::NodeSet<std::string> results; for(Arabica::XPath::NodeSet<std::string>::const_iterator n = nodes.begin(), ne = nodes.end(); n != ne; ++n) { std::string id = Arabica::XPath::impl::nodeStringValue<std::string, Arabica::default_string_adaptor<std::string> >(*n); results.push_back(keys_.lookup(keyClarkName, id, executionContext)); } // for ... results.to_document_order(); return results; } // nodeSetUnion
virtual void execute(const DOM::Node<std::string>& node, ExecutionContext& context) const { Arabica::XPath::XPathValue<std::string> value = select_->evaluate(node, context.xpathContext()); if(value.type() != Arabica::XPath::NODE_SET) { context.sink().characters(value.asString()); return; } Arabica::XPath::NodeSet<std::string> nodes = value.asNodeSet(); for(Arabica::XPath::NodeSet<std::string>::const_iterator n = nodes.begin(), e = nodes.end(); n != e; ++n) copy(*n, context); } // execute