39 #include <libxslt/xsltutils.h>
48 static xmlXPathObjectPtr
50 const char * xpath_expression,
53 int old_context_size = ctxt->xpathCtxt->contextSize;
54 int old_proximity_position = ctxt->xpathCtxt->proximityPosition;
55 int old_ns_nr = ctxt->xpathCtxt->nsNr;
56 xmlNsPtr * old_namespaces = ctxt->xpathCtxt->namespaces;
57 xmlNodePtr old_node = ctxt->xpathCtxt->node;
59 ctxt->xpathCtxt->node = node ==
NULL ? ctxt->node : node;
61 ctxt->xpathCtxt->contextSize = ctxt->xpathCtxt->proximityPosition;
63 xmlXPathObjectPtr result_obj = xmlXPathEvalExpression(
64 reinterpret_cast<const xmlChar*
>(xpath_expression),
67 ctxt->xpathCtxt->node = old_node;
68 ctxt->xpathCtxt->contextSize = old_context_size;
69 ctxt->xpathCtxt->proximityPosition = old_proximity_position;
70 ctxt->xpathCtxt->nsNr = old_ns_nr;
71 ctxt->xpathCtxt->namespaces = old_namespaces;
73 if (result_obj ==
NULL)
86 xslt_ctxt(
NULL), instruction_node(
NULL)
96 pimpl_(new
impl::extension_element_impl)
106 pimpl_(new
impl::extension_element_impl)
128 if (
this != &other) {
141 "out of XSLT context.");
144 "when there is no XSLT instruction node.");
155 "out of XSLT context.");
166 "out of XSLT context.");
168 xpath_expression,
NULL));
The xml::node class is used to hold information about one XML node.
void * get_node_data(void) const
This exception class is thrown by xmlwrapp for all runtime XSLT-related errors.
The XSLT extension element object is used to be a base class for the user provided XSLT extension ele...
virtual ~extension_element()
Destroy extension element object and clean the memory up.
xpath_object evaluate(const char *xpath_expression, const xml::node &node)
Evaluate XPath expression.
extension_element()
Create a new extension element.
impl::extension_element_impl * pimpl_
extension_element & operator=(const extension_element &other)
Create a copy of the extension element object.
void report_error(const char *error)
Report an error to the XSLT processor.
The xslt::xpath_object class is used to store extension function arguments and return values.
static xmlXPathObjectPtr evaluate_xpath_expression(xsltTransformContextPtr ctxt, const char *xpath_expression, xmlNodePtr node)
XSLT extension element object.
This file contains definition of the xslt::impl::extension_element_impl class.
xsltTransformContextPtr xslt_ctxt
xmlNodePtr instruction_node
This file contains the definition of the xslt::exception class.