Hi.
I’m trying to format ListGrid cell content using XSLT transformation. As there is no interface in smartGWT api, I’ve created some native helpers:
/* create XMLDocument js object from string */
private native JavaScriptObject xmlFromString(String xml)/*-{
return $wnd.isc.XMLTools.parseXML(xml);
}-*/;
/* must perform XSLT transformation */
private native String transform(Object inputDocument, Object styleSheet)/*-{
return $wnd.isc.XMLTools.transformNodes (inputDocument, styleSheet);
}-*/;
But something is wrong, the example below is not working:
try
{
StringBuffer sb = new StringBuffer();
parse(xmlFromString((String) value), sb);
//return sb.toString();
Object o1 = xmlFromString("<root> <node>foo</node> <node>bar</node></root>");
Object o2 = xmlFromString("<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"> <xsl:template match=\"root\"> <xsl:value-of select=\"node\"/> </xsl:template> </xsl:stylesheet>");
return transform(o1, o2);
}
catch (Exception e)
{
GWT.log("FAIL", e);
}
Result log message in GWT HostedMode browser is
[ERROR] FAIL
com.google.gwt.core.client.JavaScriptException: (null): Component returned failure code: 0x80600001 [nsIXSLTProcessor.importStylesheet]
QueryInterface:
function QueryInterface() {
[native code]
}
result: 2153775105
initialize:
function initialize() {
[native code]
}
at com.mobicon.smsbank.adminpanel.client.service.smartgwt.PacketContextCellFormatter.transform(Native Method)
at com.mobicon.smsbank.adminpanel.client.service.smartgwt.PacketContextCellFormatter.format(PacketContextCellFormatter.java:25)
What is wrong with that code?