} catch (Exception e) { e.printStackTrace(); }
  public void pipeDocument(XSLProcessorContext context, ElemExtensionCall elem)	  throws TransformerException, TransformerConfigurationException,          SAXException, IOException, FileNotFoundException	     {    try    {      SAXTransformerFactory saxTFactory = (SAXTransformerFactory) TransformerFactory.newInstance();            // XML doc to transform.      String source =  elem.getAttribute("source",                                          context.getContextNode(),                                         context.getTransformer());      TransformerImpl transImpl = context.getTransformer();      //Base URI for input doc, so base for relative URI to XML doc to transform.      String baseURLOfSource = transImpl.getBaseURLOfSource();      // Absolute URI for XML doc to transform.      String absSourceURL = SystemIDResolver.getAbsoluteURI(source, baseURLOfSource);            // Transformation target      String target =  elem.getAttribute("target",                                          context.getContextNode(),                                         context.getTransformer());            XPathContext xctxt = context.getTransformer().getXPathContext();      int xt = xctxt.getDTMHandleFromNode(context.getContextNode());       // Get System Id for stylesheet; to be used to resolve URIs to other stylesheets.      String sysId = elem.getSystemId();            NodeList ssNodes = null;      NodeList paramNodes = null;      Node ssNode = null;      Node paramNode = null;      if (elem.hasChildNodes())      {        ssNodes = elem.getChildNodes();                // Vector to contain TransformerHandler for each stylesheet.        Vector vTHandler = new Vector(ssNodes.getLength());                // The child nodes of an extension element node are instances of        // ElemLiteralResult, which requires does not fully support the standard        // Node interface. Accordingly, some special handling is required (see below)        // to get attribute values.        for (int i = 0; i < ssNodes.getLength(); i++)        {          ssNode = ssNodes.item(i);          if (ssNode.getNodeType() == Node.ELEMENT_NODE              && ((Element)ssNode).getTagName().equals("stylesheet")              && ssNode instanceof ElemLiteralResult)          {            AVT avt = ((ElemLiteralResult)ssNode).getLiteralResultAttribute("href");            String href = avt.evaluate(xctxt,xt, elem);            String absURI = SystemIDResolver.getAbsoluteURI(href, sysId);            Templates tmpl = saxTFactory.newTemplates(new StreamSource(absURI));            TransformerHandler tHandler = saxTFactory.newTransformerHandler(tmpl);            Transformer trans = tHandler.getTransformer();                        // AddTransformerHandler to vector            vTHandler.addElement(tHandler);            paramNodes = ssNode.getChildNodes();            for (int j = 0; j < paramNodes.getLength(); j++)            {              paramNode = paramNodes.item(j);              if (paramNode.getNodeType() == Node.ELEMENT_NODE                   && ((Element)paramNode).getTagName().equals("param")                  && paramNode instanceof ElemLiteralResult)              {                 avt = ((ElemLiteralResult)paramNode).getLiteralResultAttribute("name");                 String pName = avt.evaluate(xctxt,xt, elem);                 avt = ((ElemLiteralResult)paramNode).getLiteralResultAttribute("value");                 String pValue = avt.evaluate(xctxt,xt, elem);                 trans.setParameter(pName, pValue);               }              }           }         }         usePipe(vTHandler, absSourceURL, target);       }     }     catch (Exception e)     {       e.printStackTrace();     }  }