I think the method you want is executeChildTemplates from the TransformerImpl
class. I'm fairly new to Xalan, so if there is a better way I would love to
hear about it. I'm fairly confident that this will compile and run correctly,
but I have stripped a lot of my application specific code from it.
public static DocumentFragment LinkBody(XSLProcessorContext context,
ElemExtensionCall elem) {
TransformerImpl transformer = context.getTransformer();
Document doc = new org.apache.xerces.domDocumentImpl();
DocumentFragment frag = doc.createDocumentFragment();
Element link = doc.createElement("a");
link.setAttribute("href", "#");
frag.appendChild(link);
// evaluate contents of element
try {
ContentHandler handler = new
org.apache.xml.utils.DOMBuilder(doc, link);
transformer.executeChildTemplates(elem,
context.getContextNode(), context.getMode(), handler);
} catch ( TransformerException e ) {
e.printStackTrace();
}
return frag;
}
Hope this helps,
Josh
-----Original Message-----
From: Jayatheerthan K [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 04, 2003 6:21 AM
To: [EMAIL PROTECTED]
Subject: Extension element - handling nested content
Hi,
I am writing a nested extension element which looks
like the one below :
<my:Link formName="someFormName" action="someAction">
<my:LinkParam name="n1" value="v1"/>
<my:LinkParam name="n2" value="{$someParam}"/>
<my:LinkBody>
<!-- any valid XSL content or simple text could go
here -->
</my:LinkBody>
</my:Link>
This extension element would be converted to <a
href="javascript:myFunction(formname, action, 'n1=v1',
'n2=someParamValue')> processed Link Body </a>
In my extension handler Java class, I am creating an
Element object for anchor tag and appending the
LinkParam's values for href attribute.
I would like to know how I can process the my:LinkBody
contents and append it as a child to the anchor
element so that I can place the anchor element to the
output result tree.
Any pointers are very much appreciated.
Thanks,
Jayatheerthan
__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree