virtual void execute(const DOM::Node<std::string>& node, ExecutionContext& context) const
  {
    ParamPasser passer(*this, node, context);

    if(!has_sort() && select_ == 0)
    {
      if(node.hasChildNodes())
        context.stylesheet().applyTemplates(node.getChildNodes(), context, mode_);
      return;
    }

    Arabica::XPath::NodeSet<std::string> nodes;
    if(select_ == 0)
      for(DOM::Node<std::string> n = node.getFirstChild(); n != 0; n = n.getNextSibling())
        nodes.push_back(n);
    else
    {
      Arabica::XPath::XPathValue<std::string> value = select_->evaluate(node, context.xpathContext());
      if(value.type() != Arabica::XPath::NODE_SET)
        throw std::runtime_error("apply-templates select expression is not a node-set");
      nodes = value.asNodeSet();
    }
    sort(node, nodes, context);
    context.stylesheet().applyTemplates(nodes, context, mode_);
  } // execute
Beispiel #2
0
  virtual void process_content(const DOM::Node<std::string>& node, ExecutionContext& context) const
  {
    if(node.hasAttributes())
    {
      const DOM::NamedNodeMap<std::string>& attrs = node.getAttributes();
      for(unsigned int a = 0; a < attrs.getLength(); ++a)
        copy(attrs.item(a), context);
    } // if ...

    for(DOM::Node<std::string> n = node.getFirstChild(); n != 0; n = n.getNextSibling())
      copy(n, context);
  } // process_content