#include <libxml/encoding.h>
#include <libxml/xmlerror.h>
#include <libxml/xpath.h>
+#include <libxml/parserInternals.h>
#include <libxml/xpathInternals.h>
#include <libxml/HTMLtree.h>
#include "xslt.h"
if ((ctxt == NULL) || (node == NULL) || (inst == NULL))
return;
+ prop = xmlGetNsProp(inst, (const xmlChar *)"select", XSLT_NAMESPACE);
+ if (prop == NULL) {
+ xsltGenericError(xsltGenericErrorContext,
+ "xslt:copy-of : select is missing\n");
+ goto error;
+ }
#ifdef DEBUG_PROCESS
xsltGenericDebug(xsltGenericDebugContext,
"xsltCopyOf: select %s\n", prop);
"invalud value %s for disable-output-escaping\n", prop);
xmlFree(prop);
- if (disableEscaping) {
- TODO /* disable-output-escaping */
- }
}
prop = xmlGetNsProp(inst, (const xmlChar *)"select", XSLT_NAMESPACE);
if (prop == NULL) {
if (res->type == XPATH_STRING) {
copy = xmlNewText(res->stringval);
if (copy != NULL) {
+ if (disableEscaping)
+ copy->name = xmlStringTextNoenc;
xmlAddChild(ctxt->insert, copy);
}
}
if (template) {
xmlNodePtr oldNode;
+#ifdef DEBUG_PROCESS
+ xsltGenericDebug(xsltGenericDebugContext,
+ "xsltDefaultProcessOneNode: applying template for text %s\n",
+ node->content);
+#endif
oldNode = ctxt->node;
ctxt->node = node;
xsltApplyOneTemplate(ctxt, node, template->content);
ctxt->node = oldNode;
- } else if (ctxt->mode == NULL) {
+ } else /* if (ctxt->mode == NULL) */ {
+#ifdef DEBUG_PROCESS
+ xsltGenericDebug(xsltGenericDebugContext,
+ "xsltDefaultProcessOneNode: copy text %s\n",
+ node->content);
+#endif
copy = xmlCopyNode(node, 0);
if (copy != NULL) {
xmlAddChild(ctxt->insert, copy);
if (template) {
xmlNodePtr oldNode;
+#ifdef DEBUG_PROCESS
+ xsltGenericDebug(xsltGenericDebugContext,
+ "xsltDefaultProcessOneNode: applying template for text %s\n",
+ node->content);
+#endif
oldNode = ctxt->node;
ctxt->node = cur;
ctxt->xpathCtxt->contextSize = nbchild;
ctxt->xpathCtxt->proximityPosition = childno;
xsltApplyOneTemplate(ctxt, cur, template->content);
ctxt->node = oldNode;
- } else if (ctxt->mode == NULL) {
+ } else /* if (ctxt->mode == NULL) */ {
+#ifdef DEBUG_PROCESS
+ xsltGenericDebug(xsltGenericDebugContext,
+ "xsltDefaultProcessOneNode: copy text %s\n",
+ node->content);
+#endif
copy = xmlCopyNode(cur, 0);
if (copy != NULL) {
xmlAddChild(ctxt->insert, copy);
* element names consists of just xsl:text.
*/
#ifdef DEBUG_PROCESS
- xsltGenericDebug(xsltGenericDebugContext,
- "xsltApplyOneTemplate: copy text %s\n", cur->content);
+ if (cur->name == xmlStringTextNoenc)
+ xsltGenericDebug(xsltGenericDebugContext,
+ "xsltApplyOneTemplate: copy unescaped text %s\n",
+ cur->content);
+ else
+ xsltGenericDebug(xsltGenericDebugContext,
+ "xsltApplyOneTemplate: copy text %s\n", cur->content);
#endif
copy = xmlCopyNode(cur, 0);
if (copy != NULL) {
if (xpathParserCtxt != NULL)
xmlXPathFreeParserContext(xpathParserCtxt);
if (result != NULL) {
+#ifdef DEBUG_VARIABLE
+ if ((xsltGenericDebugContext == stdout) ||
+ (xsltGenericDebugContext == stderr))
+ xmlXPathDebugDumpObject((FILE *)xsltGenericDebugContext,
+ result, 0);
+#endif
if (elem->value != NULL)
xmlXPathFreeObject(elem->value);
elem->value = result;
#ifdef DEBUG_VARIABLE
xsltGenericDebug(xsltGenericDebugContext,
- "Defineing variable %s\n", name);
+ "Defineing variable %s", name);
+ if (select != NULL)
+ xsltGenericDebug(xsltGenericDebugContext,
+ " select %s", select);
+ xsltGenericDebug(xsltGenericDebugContext, "\n");
#endif
elem = xsltNewStackElem();
if (elem == NULL)
else
elem->type = XSLT_ELEM_VARIABLE;
elem->name = xmlStrdup(name);
- elem->select = xmlStrdup(select);
+ if (select != NULL)
+ elem->select = xmlStrdup(select);
+ else
+ elem->select = NULL;
if (ns_uri)
elem->nameURI = xmlStrdup(ns_uri);
elem->tree = tree;
} else {
if (cur->children != NULL)
xsltGenericError(xsltGenericErrorContext,
- "xsl:variable : content shuld be empty since select is present \n");
+ "xsl:variable : content should be empty since select is present \n");
}
ncname = xmlSplitQName2(name, &prefix);