Ken, I had to do a bit of hunting in the Xalan API but I found the TransformerImpl.transformToString() method:

The following snippet worked for me:
-------------------------
String elemValue = "";
TransformerImpl transf = XSLPC.getTransformer();
try{
  elemValue = transf.transformToString(EEC);
} catch (TransformerException e){}
-------------------------

Nathan

kenh...@nc.rr.com wrote:
Sorry about the dumb question, but I'm struggling with an extension element and getting its content.

I'm running Xalan-J 2.7.1, and am trying to implement an extension element like

<my:element attrib1="foo" attrib2="bar">text1<xsl:value-of select="$var"/>text2</my:element>

My java looks like

public void element(XSLProcessorContext XSLPC, ElemExtensionCall EEC) {
String foo = EEC.getAttribute("foo", XSLPC.getContextNode(),XSLPC.getTransformer()); // works fine String bar = EEC.getAttribute("bar",XSLPC.getContextNode(),XSLPC.getTransformer()); // works fine
    // get content, somehow
}

So far, in order to get to the content, preferably with the xsl:value-of already executed, I've tried: EEC.getFirstChild() --> ElemTemplateElement error: Function not supported! EEC.getParentNode() --> ElemTemplateElement error: Function not supported! EEC.getFirstChildElem() --> ElemTemplateElement error: Function not supported! EEC.getChildNodes().item(0) --> ElemTemplateElement error: Function not supported! XSLPC.getTransformer.getCurrentElement.getParentNode() --> ElemTemplateElement error: Function not supported!

So, this has to be brain-dead simple, but I've looked through the archives and haven't been able to dig up the solution.

Thanks,
Ken

--
Nathan Nadeau
n...@gleim.com
Software Development
Gleim Publications, Inc.
http://www.gleim.com

Reply via email to