* @param source the node to be transformed
* @return the result of the transformation
*/
public XMLDocument jsxFunction_transformToDocument(
final Node source) {
final XMLDocument doc = new XMLDocument();
doc.setPrototype(getPrototype(doc.getClass()));
doc.setParentScope(getParentScope());
final Object transformResult = transform(source);
final org.w3c.dom.Node node;
if (transformResult instanceof org.w3c.dom.Node) {
final org.w3c.dom.Node transformedDoc = (org.w3c.dom.Node) transformResult;
node = transformedDoc.getFirstChild();
}
else {
node = null;
}
final XmlPage page = new XmlPage(node, getWindow().getWebWindow());
doc.setDomNode(page);
return doc;
}