[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: <xsl-script>
David LeBlanc wrote: > > At 04:12 PM 5/11/99 -0500, you wrote: > >David LeBlanc wrote: > >> > >> It seems to me that any extensible language can be made into a convenient > >> tree manipulation language via an appropriate function library. > > > > Based on your below example (even though I think you've shifted the focus > of my issue which is the procedural elements (i.e. <xsl:if> etc.)), I > *might* strike the word "convenient" from the above. Great! That would end the argument. > THIS is not what I object to! <xsl:if>, <xsl:when> etc. is what I > object to! Do you have a proposal for keeping the containing structures of XSL and the template description syntax of XSL but using the if/then/when constructs of scripting languages? <xsl:template match="p"> if(blah.blah.blah){ <UNDERLINE><xsl:apply-templates/></UNDERLINE> }else{ <BOLD>...</BOLD> } </xsl:template> Is this that you are proposing? > That's doable, even elegantly if that's important (A quick sketch in > Smalltalk.): This is close to how we are doing it in Python. Great minds think alike! Yours hasn't handled all of the hard problems yet, though. The template syntax is not correct. You haven't got an equivalent of apply-templates. I also don't see how your "match" and "attribute" commands know what node they are working on. Even so, your match syntax is more verbose and it probably will not permit the extent of optimizations that XSL match patterns will. In Python we fixed these problems but by the time the template syntax was as convenient as XSL's but still Python-integrated it was much more verbose. > Where can XSL-extended Python be found? Well, it is currently being reworked for compatibility with the latest draft but: ftp:///starship.python.net/pub/crew/uche/4XSL/4XSL-0.6.1.tar.gz Here is a flavor of it: >>>p = PatternObject.CreateXSLPAtternObject('Chapter/Page','MatchExpr') >>>def DoSomethingWithChapterPage(node): ... print node.getNodeName() ... e.apply_templates(node) >>>e = PatternEngine() >>>e.register_pattern(p,DoSomethingWithChapterPage) >>>e.apply_templates(node) It isn't as optimized and minimized a syntax as the SmallTalk one because we aren't trying to replace XSL. We're just making XSL idioms available to Python programmers. (don't let the word "we" trick you into thinking that I am doing any of the work...I influenced the original design to allow it to be used this way but the implementors both work for a company called 4thought). > Errr.. aren't you making my original point here? If XSLT is going to be so > marvelous what need is there for a pythonated xsl (or is it an xslated > python?). No, I am not making your point. XSLT is marvelous because it is simple and powerful. Python-with-an-XSL library is marvelous because it is more powerful but still simpler than e.g. Java or Perl and cheaper than Ominmark or Balise. If you take away the XSL part of my toolkit then I lose that easy-to-use low-end. If I have to train people in a programming language before they can start making stylesheets then you've increased the ramp-up time for new hires. That's expensive. In fact, I would rather let them cut their teeth on XSL and then let them learn Python by showing them how their XSL idioms translate into Python. One thing at a time. > Is Python as a scripting language somehow less objectionable then > some other well known language such as pearl or (my favorite) Tcl? Sorry, I have to scratch an itch here: you mean Perl. Anyhow, you certainly don't want to get me started on my objections to Perl and (egad!) TCL. Luckily they are independently documented: http://cito.uwaterloo.ca/~papresco/tcl/ http://cito.uwaterloo.ca/~papresco/python/features.html -- Paul Prescod - ISOGEN Consulting Engineer speaking for only himself http://itrc.uwaterloo.ca/~papresco Diplomatic term: "Emerging Markets" Translation: Poor countries. The great euphemism of the Asian financial meltdown. Investors got much more excited when they thought they could invest in up-and-comers than when they heard they could invest in the Third World.(Brills Content, Apr. 1999) XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|