I'm trying to create a Java external to be used in a component. I want the helloElement attribute value and the text displayed in the component.
Here is my Java Code (it's a quite simple example):
package com.sayHello;
import com.interwoven.livesite.dom4j.Dom4jUtils;
import com.interwoven.livesite.runtime.RequestContext;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
public class HelloTeamsite {
public static Document hello(RequestContext context) {
Document doc = Dom4jUtils.newDocument();
Element docElement = DocumentHelper.createElement("helloElement");
docElement.addAttribute("isPolite", "Java is polite and is saying hello.");
docElement.addText("Java is still trying to say hello.");
doc.add(docElement);
return doc;
}
}
While creating my custom component, my Content XML data is:
<Data>
<External>
<Object Scope="local">com.sayHello.HelloTeamsite</Object>
<Method>hello</Method>
</External>
</Data>
When I preview the component, I notice that my hello method is called correctly and data is retrieved, as the Content XML area during the preview displays the "Java is still trying to say hello." message. The problem is that I can't present the data. I'm guessing something is wrong with my Appearance code:
<!DOCTYPE html-entities SYSTEM "http://www.interwoven.com/livesite/xsl/xsl-html.dtd">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Skin: Default (Default Browser Type) -->
<div>
<xsl:value-of select=”/Properties/Data/Results/helloElement”/>
</div>
</xsl:stylesheet>
Other trial and error attempts include:
<!DOCTYPE html-entities SYSTEM "http://www.interwoven.com/livesite/xsl/xsl-html.dtd">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Skin: Default (Default Browser Type) -->
<xsl:template match="/">
<div>
<xsl:apply-templates select="/Properties/Data/Result/helloElement" />
</div>
</xsl:template>
<xsl:template match="helloElement">
<div>
<h2>
<xsl:value-of select="isPolite" disable-output-escaping="yes"/>
</h2>
</div>
</xsl:template>
</xsl:stylesheet>
Any help is appreciated.