diff --git a/ChangeLog b/ChangeLog
index 48a07afb6c1bd25f405363d23c8e5a7f9257bcbc_Q2hhbmdlTG9n..d482e049d59142305c2a96bdfb3b3130d129d958_Q2hhbmdlTG9n 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Jan 12 22:33:07 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
+
+	* pattern.c, xslt.c: removed debug
+	* transform.c: added value-of, seems to handle the first
+	  REC example correctly
+
 Fri Jan 12 18:34:01 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
 
 	* transform.c, xsltproc.c: small fight with spaces and formatting
diff --git a/libxslt/pattern.c b/libxslt/pattern.c
index 48a07afb6c1bd25f405363d23c8e5a7f9257bcbc_bGlieHNsdC9wYXR0ZXJuLmM=..d482e049d59142305c2a96bdfb3b3130d129d958_bGlieHNsdC9wYXR0ZXJuLmM= 100644
--- a/libxslt/pattern.c
+++ b/libxslt/pattern.c
@@ -22,7 +22,7 @@
 #include "xslt.h"
 #include "xsltInternals.h"
 
-#define DEBUG_PARSING
+/* #define DEBUG_PARSING */
 
 #define TODO 								\
     xsltGenericError(xsltGenericErrorContext,				\
diff --git a/libxslt/transform.c b/libxslt/transform.c
index 48a07afb6c1bd25f405363d23c8e5a7f9257bcbc_bGlieHNsdC90cmFuc2Zvcm0uYw==..d482e049d59142305c2a96bdfb3b3130d129d958_bGlieHNsdC90cmFuc2Zvcm0uYw== 100644
--- a/libxslt/transform.c
+++ b/libxslt/transform.c
@@ -22,9 +22,10 @@
 #include <libxml/encoding.h>
 #include <libxml/xmlerror.h>
 #include <libxml/xpath.h>
+#include <libxml/xpathInternals.h>
 #include <libxml/HTMLtree.h>
 #include "xslt.h"
 #include "xsltInternals.h"
 #include "pattern.h"
 #include "transform.h"
 
@@ -25,10 +26,10 @@
 #include <libxml/HTMLtree.h>
 #include "xslt.h"
 #include "xsltInternals.h"
 #include "pattern.h"
 #include "transform.h"
 
-#define DEBUG_PROCESS
+/* #define DEBUG_PROCESS */
 
 /*
  * To cleanup
@@ -80,6 +81,7 @@
     xsltStylesheetPtr style;		/* the stylesheet used */
     xsltOutputType type;		/* the type of output */
 
+    xmlDocPtr doc;			/* the current doc */
     xmlNodePtr node;			/* the current node */
     xmlNodeSetPtr nodeList;		/* the current node list */
 
@@ -87,6 +89,7 @@
     xmlNodePtr insert;			/* the insertion node */
 
     xmlXPathContextPtr xpathCtxt;	/* the XPath context */
+    xmlXPathParserContextPtr xpathParserCtxt;/* the XPath parser context */
 };
 
 /************************************************************************
@@ -126,6 +129,8 @@
 xsltFreeTransformContext(xsltTransformContextPtr ctxt) {
     if (ctxt == NULL)
 	return;
+    if (ctxt->xpathCtxt != NULL)
+	xmlXPathFreeContext(ctxt->xpathCtxt);
     memset(ctxt, -1, sizeof(xsltTransformContext));
     xmlFree(ctxt);
 }
@@ -139,6 +144,99 @@
 void xsltProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr node);
 
 /**
+ * xsltValueOf:
+ * @ctxt:  a XSLT process context
+ * @node:  the node in the source tree.
+ * @inst:  the xsltValueOf node
+ *
+ * Process the xsltValueOf node on the source node
+ */
+void
+xsltValueOf(xsltTransformContextPtr ctxt, xmlNodePtr node,
+	           xmlNodePtr inst) {
+    xmlChar *prop;
+    int disableEscaping = 0;
+    xmlXPathObjectPtr res, tmp;
+    xmlNodePtr copy = NULL;
+
+    if ((ctxt == NULL) || (node == NULL) || (inst == NULL))
+	return;
+
+    prop = xmlGetNsProp(inst, (const xmlChar *)"disable-output-escaping",
+	                XSLT_NAMESPACE);
+    if (prop != NULL) {
+	if (xmlStrEqual(prop, (const xmlChar *)"yes"))
+	    disableEscaping = 1;
+	else if (xmlStrEqual(prop, (const xmlChar *)"no"))
+	    disableEscaping = 0;
+	else 
+	    xsltGenericError(xsltGenericErrorContext,
+		 "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) {
+	xsltGenericError(xsltGenericErrorContext,
+	     "xsltValueOf: select is not defined\n", prop);
+	return;
+    }
+#ifdef DEBUG_PROCESS
+    xsltGenericError(xsltGenericErrorContext,
+	 "xsltValueOf: select %s\n", prop);
+#endif
+
+    if (ctxt->xpathCtxt == NULL) {
+	xmlXPathInit();
+	ctxt->xpathCtxt = xmlXPathNewContext(ctxt->doc);
+	if (ctxt->xpathCtxt == NULL)
+	    goto error;
+    }
+    ctxt->xpathParserCtxt =
+	xmlXPathNewParserContext(prop, ctxt->xpathCtxt);
+    if (ctxt->xpathParserCtxt == NULL)
+	goto error;
+    ctxt->xpathCtxt->node = node;
+    valuePush(ctxt->xpathParserCtxt, xmlXPathNewNodeSet(node));
+    xmlXPathEvalExpr(ctxt->xpathParserCtxt);
+    xmlXPathStringFunction(ctxt->xpathParserCtxt, 1);
+    res = valuePop(ctxt->xpathParserCtxt);
+    do {
+        tmp = valuePop(ctxt->xpathParserCtxt);
+	if (tmp != NULL) {
+	    xmlXPathFreeObject(tmp);
+	}
+    } while (tmp != NULL);
+    if (res != NULL) {
+	if (res->type == XPATH_STRING) {
+            copy = xmlNewText(res->stringval);
+	    if (copy != NULL) {
+		xmlAddChild(ctxt->insert, copy);
+	    }
+	}
+    }
+    if (copy == NULL) {
+	xsltGenericError(xsltGenericErrorContext,
+	    "xsltDefaultProcessOneNode: text copy failed\n");
+    }
+#ifdef DEBUG_PROCESS
+    else
+	xsltGenericError(xsltGenericErrorContext,
+	     "xsltValueOf: result %s\n", res->stringval);
+#endif
+error:
+    if (ctxt->xpathParserCtxt != NULL)
+	xmlXPathFreeParserContext(ctxt->xpathParserCtxt);
+    if (prop != NULL)
+	xmlFree(prop);
+    if (res != NULL)
+	xmlXPathFreeObject(res);
+}
+
+/**
  * xsltCopyNode:
  * @ctxt:  a XSLT process context
  * @node:  the element node in the source tree.
@@ -335,6 +433,10 @@
 		ctxt->insert = insert;
 		xsltApplyTemplates(ctxt, node, cur);
 		ctxt->insert = oldInsert;
+	    } else if (IS_XSLT_NAME(cur, "value-of")) {
+		ctxt->insert = insert;
+		xsltValueOf(ctxt, node, cur);
+		ctxt->insert = oldInsert;
 	    } else {
 #ifdef DEBUG_PROCESS
 		xsltGenericError(xsltGenericErrorContext,
@@ -435,6 +537,7 @@
     ctxt = xsltNewTransformContext();
     if (ctxt == NULL)
 	return(NULL);
+    ctxt->doc = doc;
     ctxt->style = style;
     if ((style->method != NULL) &&
 	(!xmlStrEqual(style->method, (const xmlChar *) "xml"))) {
diff --git a/libxslt/xslt.c b/libxslt/xslt.c
index 48a07afb6c1bd25f405363d23c8e5a7f9257bcbc_bGlieHNsdC94c2x0LmM=..d482e049d59142305c2a96bdfb3b3130d129d958_bGlieHNsdC94c2x0LmM= 100644
--- a/libxslt/xslt.c
+++ b/libxslt/xslt.c
@@ -23,7 +23,7 @@
 #include "xsltInternals.h"
 #include "pattern.h"
 
-#define DEBUG_PARSING
+/* #define DEBUG_PARSING */
 
 /*
  * To cleanup