Hi!
I've read a discussion about wrapping Sarissa (a cross browser
JavaScript library for XSLT) for using with GWT by Eric Bessette:
http://www.ebessette.com/d/software/XSLTForGWT
It was very useful for me, Eric, if you read this, thank you.
I've tried it, and I've studied Sarissa, and I didn't like it (okay, I
admit that I'm not a bigtime JavaScript person anyway, but I found it
quite ugly). So I decided to write my own wrapper, but not around
Sarissa (which is a wrapper already, so to say).
I want to use GWT's JSNI to join to the JavaScript interface of
browsers' native XSLT implementation, and the Deferred Binding to
handle the differences between browsers.
First, I came up with a couple of classes forming a GWT module, which
essentially solve the problem, but I don't like them, because they are
responsible for everything: there are methods for getting the xml and
xslt files asynchronously, then to parse them, then to transform them,
even to attach the result to the browser's DOM (that's my use case).
However, I realized, that parsing is already implemented in
com.google.gwt.xml.client.XMLParser. This is where it's getting
interesting.
I noticed that if I want to get JavaScriptObject from the
com.google.gwt.xml.client.Document, which is the result of
com.google.gwt.xml.client.XMLParser.parse(String contents), I have to
get to the underlying implementations. E.g.:
<code>
public final Document transformToDocument(Node source) {
return (Document) NodeImpl.build(
transformToDocumentImpl(
((NodeImpl) source).getJsObject()));
}
</code>
However, NodeImpl class's access is not public, but default, meaning
package level visibility. So I guess, I have to create my
XSLTProcessor class in com.google.gwt.xml.client package. Am I on the
right track?
My second question is coming from my confusion around the different
implementations of Dom/Xml handling. It goes like this:
If I want to attach the (html) result of an XSL Transformation to my
DOM (the one that's in the browser at the time), I figured, I have to
say:
<code>
DOM.appendChild(DOM.getElementById("resultContainer"), domNodeResult);
</code>
However, domNodeResult's type has to be
com.google.gwt.user.client.Element, and not
com.google.gwt.xml.client.Element. So I guess, I'm gonna have a
<code>
XSLTProcessor.transformToUserClientElement(source);
</code>
method, or something like this. (I actually tried it, and it works.
I'd just like to have a disscussion about this with anyone care to
look into this situation).
Arpad
ps. I'm striving for a solution, which - if being finished - will be
very much likely to the one Google will come up with, if they (you?)
ever implement XSLT for GWT. :) (Oh, and if it's already done, but I
haven't noticed it, I'll be embarrased for ever :P )
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.