Index: ElemVariable.java
===================================================================
--- ElemVariable.java	(revision 834286)
+++ ElemVariable.java	(working copy)
@@ -211,7 +211,19 @@
     return Constants.ELEMNAME_VARIABLE_STRING;
   }
 
+  private XPath override;
+
   /**
+   * An override that can be called by an extension element to change the value that will be stored
+   * for this variable.
+   *
+   * @param  override The new xpath;
+   */
+  public void overrideChildDocument(XPath override){
+    this.override = override;
+  }
+
+  /**
    * Copy constructor.
    *
    * @param param An element created from an xsl:variable
@@ -315,7 +327,11 @@
 			//////////////xctxt.getVarStack().unlink(); 
 			}
 
-        var = new XRTreeFrag(df, xctxt, this);
+        if(override == null) var = new XRTreeFrag(df, xctxt, this);
+        else{ 
+	   var = override.execute(xctxt, sourceNode, this);
+	   var.allowDetachToRelease(false);
+	}
       }
     }
     finally
