xsltal contribution
Hi Bertrand today implemented XSLTAL into cocoon and asked me, if I could officially contribute my tal2xslt.xsl, which I gladly will do with this email. You can grab it here, put any License-stuff onto it you need and do whatever you want with it :) http://svn.bitflux.ch/repos/public/popoon/trunk/components/transformers/xsltal/tal2xslt.xsl A little bit more info about XSLTAL can be found here: http://wiki.bitflux.org/Templates_TAL And I'm giving a talk tomorrow about it here at ApacheCon, so if you're in the area, drop by at 10:30 :) chregu -- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB
Re: getElementById in request does not work
Hi On 4.1.2005 9:25 Uhr, Stefan Pietschmann wrote: Hi there, I'm writing my custom action, and this is my problem with it: I fetch a parameter from the request (which is sent with a form). It contains an small rdf snippet. I thought I'd be able to read it out with getelementbyid, but it doesn't work. The request parameter looks like this: Maybe this helps a little bit: http://blog4.bitflux.ch/wiki/GetElementById_Pitfalls (It's written for PHP, but the problem applies to other languages as well...) chrgeu . . . . And my code looks like this (shortened): ## // requestParameterID is the name of the request parameter // get the request Request request = ObjectModelHelper.getRequest(objectModel); // now build a document from the rdf in the request factory = DocumentBuilderFactory.newInstance(); // requestParam should now be the xml from above requestParam = factory.newDocumentBuilder().parse( new InputSource(new StringReader(request.getParameter(requestParameterID; // now I should be able to do something like this, right? requestParam.getElementsById("UserInteraction"); ### --> this returns null. Why? If I iterate through all Elements, I find it though (like this:) ### NodeList descriptions = requestParam.getElementsByTagName("Description"); String thisID; for (int a = 0; a < descriptions.getLength(); a++) { if ((thisID = descriptions.item(a).getAttributes().getNamedItem("id").getNodeValue()) != null) { if (thisID.equals("UserInteraction")) { System.out.println("found userinteraction"); } } } So I do find the right element and it does exist, but why can't I use getElementById instead of going through all elements? Thanx, Stefan -- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB
Re: Templating: experiments with Conal's html-to-xslt transform
On 13.12.2004 8:22 Uhr, Bertrand Delacretaz wrote: Hi Christian, ...I don't know, which is more complicated, can't tell. But I took your example and wrote it in TAL. See http://wiki.bitflux.org/Templates_TAL_Example for details... Thanks, this looks really interesting. I'll have a closer look ASAP. JFYI. Add just added METAL support. From my Blogpost <http://blog.bitflux.ch/archive/added-metal-support-to-xsl-tal.html>: *** METAL is the ZPT/TAL way of replacing parts of your template with parts from other templates, for example for footers and headers. I implemented basic support for that in our tal2xslt template. metal:fill-slot and metal:define-slot are still missing, but should be doable. *** chregu -Bertrand -- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB
Re: Templating: experiments with Conal's html-to-xslt transform
On 10.12.2004 14:24 Uhr, Bertrand Delacretaz wrote: Hi Christian, ...As I mentioned before (to one of stefano's posts), we did something similar, but with the TAL syntax. We convert that to XSLT with XSLT and then do the actual transformation with XSLT. It's the same idea as yours. I like the approach, even though it's not complete yet (our implementation) and we could certainly add some of your ideas... Sorry that I overlooked this, I was busy at the time and forgot about it (and we didn't meet at the non-happening Bern dinner, too bad - our day will come ;-). No problem. I'm busy most of the time, too. And the dinner was just postponed, AFAIK ;) ...http://svn.bitflux.ch/repos/public/bxcmsdemo/themes/bxcms/ template.tal. Trying to jump into the head of the "average HTML template designer", to me this looks more complicated to understand than the example at http://wiki.apache.org/cocoon/HtmlToXsltExperiments. But you're setting attributes and I'm not, might account for some of the differences in (perceived) complexity. I don't know, which is more complicated, can't tell. But I took your example and wrote it in TAL. See http://wiki.bitflux.org/Templates_TAL_Example for details. The main difference between your and my implemention looks like the {foo/bar} syntax vs. the tal:content attribute syntax. I don't know, which one's better. In TAL we could provide both ways (where one is just an alias to the other). The rest is more or less just another syntax, with the same idea. The reason, why I took TAL as a starting point was that TAL is used since years (AFAIK) in the Zope community and the syntax has proven to be somehow useable. So why reinventing the wheel ;) And even if Zope doesn't use XML as "we" do, the choosen approach for accesing Zope-Objects was very near to the XPath syntax and an implementation quite easy. ...I don't say, our approach is better than yours, I didn't build an opinion on that. But maybe we could join efforts in it. As it's a pure XSLT implementation, the programming language behind doesn't really matter... Right, this is purely an XSLT thing. And joining efforts is good, even if it's only stealing ideas back and forth. I don't think we (Cocoon and bitflux) necessarily need to agree on everything, the resutling XSLT code won't be very big anyway. Agreed. And I already started with stealing ideas ;) I implemented the @match idea in our TAL implementation. Very simple, but certainly "good enough" for 95% of the use-cases. For the another 5% I added @include support. With this you can include external xslt-files with additional, maybe more complicated xsl:templates. There's more information about that on the wiki page mentioned above. After replying to Daniel, I think having a "declarative rules" section or not in the template is a key point: IMHO the "copy some elements with minor changes" scenario is very common, the bindings.xml use-case in my example shows this. How would you handle this with your syntax? For example, transforming an XHTML input document by adding class attributes to and elements, without knowing where they appear in the input? foo bar.. like you ;) The original TAL has no concept of element matchers or similar. Just moving around strings (and escaping or not escaping them). This is what XSLT makes so powerfull and why I dislike all "traditional" templating systems in general. But with the match attribute idea from html2xslt, we can use this feature here as well. Thanks for the input ;) In my example you just need to add a "declarative rules" section like this, assuming you have an apply-templates in the main section: Note that we can add text here to explain what's happening. Here we add a class attribute to p's Add a border to tables: I did not use the id="atl-templates" idea. You can write your matchers in any position you want in my approach. Adding Text-To-Explain is not really needed here, there are other ways to do that in TAL. chregu -- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB
Re: Templating: experiments with Conal's html-to-xslt transform
On 11.12.2004 18:37 Uhr, Gregor J. Rothfuss wrote: Christian Stocker wrote: As I mentioned before (to one of stefano's posts), we did something similar, but with the TAL syntax. We convert that to XSLT with XSLT and then do the actual transformation with XSLT. It's the same idea as yours. I like the approach, even though it's not complete yet (our implementation) and we could certainly add some of your ideas. Here's the XSLT http://svn.bitflux.ch/repos/public/popoon/trunk/components/transformers/xsltal/tal2xslt.xsl and here's simplel template http://svn.bitflux.ch/repos/public/bxcmsdemo/themes/bxcms/template.tal I don't say, our approach is better than yours, I didn't build an opinion on that. But maybe we could join efforts in it. As it's a pure XSLT implementation, the programming language behind doesn't really matter. and to take this one step further, what would it take to make these templates editable in BXE? being able to make layout changes inside the lenya GUI, say, would rock. The templates are XML, so in principle, no problem for BXE. If it's attribute driven, even less. What would really rock is some templating-enhanced mode. Not sure, what that should include, but maybe some straightforward adding-template-attributes stuff or real-time transformation to see the actual result or Build-My-XPath wizards or whatever. Btw, I didn't find the time to compare TAL with Conal's approach, but I should have some time tomorrow to do that and build an opinion on my own.. chregu -- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB
Re: Templating: experiments with Conal's html-to-xslt transform
On 10.12.2004 11:27 Uhr, Bertrand Delacretaz wrote: (ccing users@ as I'm sure many subscribers there could contribute to this experiment as well, please discuss on dev@) I've been playing [1] with Conal Tuohy's transform [2], to generate XSLT transforms based on simple attribute-based templates (HTML in this case, could be whatever) and I like it very much. Converting attribute-based templates to XSLT instead of processing them directly is fairly easy to implement, easy to use for the template writer yet powerful by giving access, when needed, to all XSLT constructs. And the syntax of attributes like for-each or apply-templates *is* XSLT, so Bob can ask Alice for help when needed ([3]). There's more info, including source code, on the wiki [1]. Feel free to use this page as a poor man's source code control system for improving this, if people like it we might want to include this our distribution? Compared to Conal's version, the current version allows "element templates" to be defined in the HTML template, they are similar to XSLT templates but much easier to write. I think this adds a lot of power while allowing the template to remain concise and modular, and "fairly" editable in visual tools. There has to be a compromise somewhere I think, converting XML data to HTML or another format *is* programming at some stage, the "100% visual" paradigm does not work for this in today's world IMHO. Comments/opinions/enhancements/flames are welcome (well, maybe not flames but if you think this sucks I'm all ears ;-) As I mentioned before (to one of stefano's posts), we did something similar, but with the TAL syntax. We convert that to XSLT with XSLT and then do the actual transformation with XSLT. It's the same idea as yours. I like the approach, even though it's not complete yet (our implementation) and we could certainly add some of your ideas. Here's the XSLT http://svn.bitflux.ch/repos/public/popoon/trunk/components/transformers/xsltal/tal2xslt.xsl and here's simplel template http://svn.bitflux.ch/repos/public/bxcmsdemo/themes/bxcms/template.tal I don't say, our approach is better than yours, I didn't build an opinion on that. But maybe we could join efforts in it. As it's a pure XSLT implementation, the programming language behind doesn't really matter. chregu -- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB
Re: [FYI] Cocoon clones
Hi On 7.12.2004 12:22 Uhr, Sylvain Wallez wrote: I just found http://xml-dtc.org/ which is a Cocoon clone written in... C! Popoon, Papaan, xml-dtc... maybe we should create a page title "Cocoon clones"? Hehe, We (Popoon) are one of the offenders ;) Being cloned is somehow flattering as it shows that our ideas aren't that bad, even if they seem to be years behind in terms of features... Our idea was never to actually "clone" cocoon (but I don't mind naming it "Cocoon clone"), but to take the sitemap idea and implement that in PHP. So what we basically did was taking the sitemap syntax of cocoon, some ideas for generators/transformers/serializers and implemented that in PHP (Version 5, nowadays, since it has much better XML support). The cocoon sitemap has been proven working for a lot of people, therefore it made sense to us to build on that. The whole idea started by the way after hearing a talk by Giacomo Pati at OSCOM 1 back in 2002 ;) There are a lot of features missing, of course (I'm very jealous to the whole continuation stuff, for example), and some components just don't make that much sense to port to PHP. But it works for us and has most of the features we need. I really like to thank the cocoon community for the input you're continously giving to us. I hope, I can contribute some stuff/ideas back (I'm not that long subscribed to this mailinglist). Just don't ask me, why we didn't just take cocoon in the first place ;) chregu -- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB
Re: [RT] do me a favor, don't call them taglibs
On 3.12.2004 21:50 Uhr, Stefano Mazzocchi wrote: All I ask from a template language: 1) something that HTML designers can edit with Dreamweaver 2) something that doesn't use namespaced tags to identify dynamic scopes (clashes with #1) 3) something that doesn't use the name taglib > > That's pretty much all you have to do to make me happy. Maybe Zope's TAL idea is something for you. http://www.zope.org/Wikis/DevSite/Projects/ZPT/TAL They are very fond of the fact that it's "Dreamweaver-Compatible" I once started implementing that in my own framework (a php based cocoon ripoff ;) ), but with using XSLT for transforming the TAL to another XSLT, which then transformed the actual content. I never really finished it (meaning implementing most of the specs), but it was basically working. Take it as a proof of concept ;) The XSLT can be found here: http://svn.bitflux.ch/repos/public/popoon/trunk/components/transformers/xsltal/tal2xslt.xsl (the bxf:tales function is framework specific and would have to be adjusted a little bit for general use, IIRC) chregu -- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB