[Dojo-interest] Re: JSON for XSLT (was dojo.xml.XlsTransform
feature request )
Sasha Firsov
Sasha at ngb.biz
Thu Jan 25 11:51:59 MST 2007
for some reason, FireFox messed with reply order, latest sown with '>'
inline...
Robert Koberg wrote:
> On Thu, 25 Jan 2007 09:45:05 -0500, Sasha Firsov <Sasha at ngb.biz> wrote:
>
> Robert, "good" or "bad" idea is up to user, is it?
> I could confirm that for several another huge projects. All using the
> "bad" one :)
>
> > Well, Joerg's way is not a terrible one since they put the PI in on
> the server rather than having it live in the source.
PI with XSLT link are quite usefull, especially on stage of matching
xsl-xml. I have been using static XML as sample for UI (XSL) developer.
In web app, XML foes from server, while for all use cases we had set of
XMLs. IE is quite handy as XML browser with XSL rendering.
> The purpose of framework is to support as much design patterns as
> possible. And many XML+XSLT ones use XSL link inside of XML.
>
>
> > One other thing I forgot to add to my last post to Joerg is that you
> can cache the processor object. Using the PI, you would need to
> recreate it each time.
It depends from renderer implementation. Nobody prevents cashing and
most actually treat XSL as regular HTTP file in terms of caching. So I
doubt your statement as true. Even if you are using XHR, caching is an
option.
> > Anyway, the XslTransform expects a DOM source object. So, you could
> extract the XSL URI from the PI and provide it - still works.
>
>
>
> Than, I see another way of use XML+XSLT in dojo. In a same way as we
> have reference to external HTML in widgets like ContentPane, it would be
> nice to have reference to XML with embedded link to XSLT (and/or links
> to both). I have been forced to use server-side transformation to
> perform that. As AJAX developer, I see no reason not to implement it
> within dojo.
>
> > I am not sure I understand.
ContentPane is able to get it`s content from external HTML file. But
this file could be result of XML/XSLT render.
So proposal is in taking XML&XSL as source for content.
> Following recent development trend, I would recommend to use JSON in
> addition to XML as data source for transformation. Since JSON could
> easily became a part of DOM, there is no difference from transformation
> point, does the source came from XML or JSON.
> Special entry in JSON could simulate XSLT link for XML :) Actually, that
> is serious demand.
>
> > Again, I am not sure I understand. But you could easily convert JSON
> to an XML DOM (albeit with very general element names). and pass that
> to the XslTransform.
Right, but why to perform this external step, if it could be supported
natively by dojo?
JSON is equal to XML and HTML entity in many aspects in dojo.
dojo.io.bind, for example.
To make JSON as part of XSL renderer would be logical assumption. Say,
if bind returns xml with PI(xsl rendering instruction link), it shall
render this XML and return as HTML data.
Funny, in that case no changes need to be done in ContentPane to support
XML/XSL as content source.
How set it to wish list?
> > best,
> > -Rob
>
>
>
> Sasha
>
>
> Robert Koberg wrote:
> >>> On Thu, 25 Jan 2007 05:17:05 -0500, Joerg-D Schneider
> >>> <joerg-d.schneider at db.com> wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> having played around with the newly introduced dojo.xml.XslTransform
> >>>> package, I'd suggest to support xml documents that contain a xsl
> >>>> stylesheet processing instruction as well, instead of naming the
> >>>> stylesheet to be used as a parameter to the XslTransform
> constructor. I'd
> >>>> think that using the respective xml processing instruction is quite
> >>>> common
> >>>> (in our project we only use this appraoch, so the xml to be
> transformed
> >>>> contains the information about what stylesheet to use) and should
> >>>> therefore be handled by the framework.
> >>>
> >>> I think it is a bad decision to have your stylesheet tightly coupled
> >>> with your instance document. You will run into problems.
> >>>
> >>>
> >>>> I attached a small utility method,
> >>>> that extracts the stylesheet name from an xml document processing
> >>>> instruction and tested against IE6+7 and firefox 2.0.0.1 and it
> seem to
> >>>> work correctly for these browsers.
> >>>>
> >>>> Support for this feature would also make it possible to use the
> >>>> xsl-transformation as a "static" method, without the need to
> >>>> instantiate a
> >>>> XslTransform object first, wouldn't it ? A transformation could then
> >>>> easily be done, with a single line of code :-)
> >>>>
> >>>> Here is the utility method :
> >>>>
> >>>> getStylesheetFromXML = function (xml) {
> >>>> if(xml != null) {
> >>>> for(var j=0;j<xml.childNodes.length;j++) {
> >>>> if(xml.childNodes[j].nodeName == 'xml-stylesheet') {
> >>>> stylesheet = xml.childNodes[j].nodeValue.split("\"")[1];
> >>>> dojo.debug(stylesheet);
> >>>> return stylesheet;
> >>>> }
> >>>> }
> >>>> }
> >>>> return null;
> >>>> }
> >>>
> >>> But you would still need to instantiate the XslTransform, right? But
> >>> anyway, doesn't simply parsing the XML instance invoke the transform?
> >>> Why do you need to parse out the PI attribute value?
> >>>
> >>> best,
> >>> -Rob
> >>>
> >>>>
> >>>>
> >>>> Mit freundlichen Grüßen / Kind regards
> >>>>
> >>>> Joerg Schneider
> >>>> Domestic Custody Services - IT (DCS- IT)
> >>>> Deutsche Bank AG
> >>>> Tel : +49 (69) 910 64186
> >>>> Fax : +49 (69) 910 69817
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>>
> >>>> Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte
> >>>> Informationen. Wenn Sie nicht der richtige Adressat sind oder diese
> >>>> E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den
> >>>> Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie
> >>>> die unbefugte Weitergabe dieser Mail ist nicht gestattet.
> >>>>
> >>>> This e-mail may contain confidential and/or privileged
> information. If
> >>>> you are not the intended recipient (or have received this e-mail in
> >>>> error) please notify the sender immediately and destroy this e-mail.
> >>>> Any unauthorized copying, disclosure or distribution of the material
> >>>> in this e-mail is strictly forbidden.
> >>>
> >>>
> >>>
> >>> --Using Opera's revolutionary e-mail client:
> http://www.opera.com/mail/
> >>>
> >>> _______________________________________________
> >>> Dojo FAQ: http://dojo.jot.com/FAQ
> >>> Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
> >>> Dojo-interest at dojotoolkit.org
> >>> http://dojotoolkit.org/mailman/listinfo/dojo-interest
> >>>
>
>>
_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
Dojo-interest at dojotoolkit.org
http://dojotoolkit.org/mailman/listinfo/dojo-interest
>>
> --Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
> _______________________________________________
> Dojo FAQ: http://dojo.jot.com/FAQ
> Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
> Dojo-interest at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
More information about the Dojo-interest
mailing list