xml-xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hall, Joe" <Joe.H...@Avnet.com>
Subject RE: create xsl programmatically using xalan API?
Date Fri, 14 May 2004 13:16:59 GMT
Could you just use a StringBuffer containing xslt and pass it in as an InputSource?

-----Original Message-----
From: Jeffrey Hau [mailto:jh398@doc.ic.ac.uk]
Sent: Friday, May 14, 2004 9:14 AM
To: Henry Zongaro
Cc: xalan-j-users@xml.apache.org
Subject: Re: create xsl programmatically using xalan API?



On 14 May 2004, at 14:03, Henry Zongaro wrote:

> Hi, Jeffrey.
>
> Jeffrey Hau <jh398@doc.ic.ac.uk> wrote on 2004-05-13 12:04:59 PM:
>> is there info on how to create xsl programmatically using the API? i
>> tried using various classes in the org.apache.xalan.templates package
>> but keep on running into errors when trying to nest elements. say
>> creating an element like,
>>
>> <xsl:template match="/">
>>    <html>
>> </xsl:template>
>>
>> i use the following code,
>>
>> Stylesheet sheet = new StylesheetRoot(null);
>> ElemTemplate template = new ElemTemplate();
>> template.setMatch(new XPath("/", null, null, XPath.MATCH));
>> template.setStylesheet(sheet);
>> org.w3c.dom.Element testEle = template.createElement("Test");
>> template.appendChild(testEle);
>
>      The easiest way I can think of would be to construct a DOM tree 
> that
> represents your stylesheet,
that would be easy for a one off solution but i need more of an API to 
give me the ease of creating xslt dynamically. to do that i will need 
to create a whole lot of classes to represent various XSLT elements. 
That's why i am looking at reusing the xalan templates classes instead 
of creating my own representation.

> and pass that into the
> TransformerFactory.newTransformer method inside of a DOMSource object. 
>  Is
> that sufficient, or do you have some other requirement in addition to
> being able to create the stylesheet programmatically, that makes you 
> want
> to use the classes in org.apache.xalan.templates directly?
i have no additional requirement apart from creating stylesheet 
prgrammatically, but i would like to know if there is an API that i can 
use, instead of creating my own.

thanks

Jeff

>
> Thanks,
>
> Henry
> ------------------------------------------------------------------
> Henry Zongaro      Xalan development
> IBM SWS Toronto Lab   T/L 969-6044;  Phone +1 905 413-6044
> mailto:zongaro@ca.ibm.com
>


Mime
View raw message