You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Patrick Moore <pa...@rioport.com> on 2001/02/28 00:22:07 UTC

RE: Returning XML from extension function. context.processor.get DOMFactory() in Xalan extension function

Are these cool little tricks documented anywhere?

> -----Original Message-----
> From: Gary L Peskin [mailto:garyp@firstech.com]
> Sent: Tuesday, February 27, 2001 3:08 PM
> To: xalan-dev@xml.apache.org
> Subject: Re: Returning XML from extension function.
> context.processor.getDOMFactory() in Xalan extension function
> 
> 
> > "Roytman, Alex" wrote:
> > so my question is:
> > Is it possible to get XSLProcessorContext or DOMFactory 
> (Document used
> > by Xalan as a factory) in an extension function and if not what else
> > can I do to return XML from an extension function
> > 
> 
> Alex --
> 
> In XalanJ2, you should be able to use an ExpressionContext as 
> the first
> argument in your extension function.  It will be 
> automatically supplied
> by XalanJ2.  You can use the getContextNode() method to get 
> the current
> context node and getOwnerDocument() from there.
> 
> Gary
> 

Re: Returning XML from extension function. context.processor.getDOMFactory() in Xalan extension function

Posted by Gary L Peskin <ga...@firstech.com>.
Patrick Moore wrote:
> 
> Are these cool little tricks documented anywhere?
> 

Just where you'd expect, I think:

http://xml.apache.org/xalan-j/extensions.html#ext-functions

Gary

Problem transformations with tomcat

Posted by Callum Elliott <C....@student.lboro.ac.uk>.
Hi,

I'm using tomcat 3.2.1 with xalan 2.0 and IAS 4.5.  I have written my own
jsp tags that take an element and an xsl url and transform them.  There is
no problem with the transformation when tested with
org.apache.xalan.xslt.Process, but when used within my tag class I just get
the following output:

<?xml version="1.0" encoding="UTF-8"?>

Which should be the newly transformed HTML.  I've had problems with IAS,
Tomcat and Xalan recently, as each seems to come packaged with it's own dom
implementation.  I managed to fix it (with help from this mailing list), or
so I thought.  I've manually placed the xalan and xerces jars at the
begining of the tomcat startup classpath (a bit of a kludge, I know), so it
should be reading the correct classes.

Here is my transformation code:

		URL xslUrl = new URL("http", "localhost", 80, xsl);

            TransformerFactory tFactory = TransformerFactory.newInstance();
            Templates templates = tFactory.newTemplates(new
StreamSource(xslUrl.toExternalForm()));
            Transformer transformer = templates.newTransformer();
            transformer.transform(new DOMSource(xmlData), new
StreamResult(pageContext.getOut()));

Any ideas?

Thanks,

Callum Elliott