From: James Britt Date: 2005-06-21T10:54:40+09:00 Subject: Re: Ruby/REXML vs XSLT John Carter wrote: > I'm just looking at 5000 lines of the gnarliest XSLT that generates out > of XML some C to pack and unpack a serial protocol. > > Ooo, it's ugly, ugly, ugly. > > Anyone ever tried to do something in both Ruby REXML and the samething > in XSLT? Um, not exactly. I've tried doing some XSLT stuff in Ruby, ran into various issues (lack of a spec-complete Ruby XLST engine being one of them), and found that using the REXML stream parser made life easier overall. > > Was it prettier in Ruby? By far. > > Was it easier? Fewer lines of Code? (by what ratio) Easier in most ways, and easier overall. The logic is different, so if you're used to doing a transformation in XSLT (am ostensibly functional language) and then try to do the same thing in REXML, you need to shift your perspective. > > How about speed? The XSLT is chewing on 14500 lines of XML in (almost) > too long a time. What XSLT engine are you using? I've found that a big bottleneck can be having to load a large document into memory for processing. Using a stream or pull parser alleviates much of that, but that may not be an option (depends on the sort of document and the nature of the transformation). But if your source XML can be broken into small subsets and transformed in segments, stream or pull transformation may be a good choice. > > I itch to rewrite it. Go for it. > > > > John Carter Phone : (64)(3) 358 6639 > Tait Electronics Fax : (64)(3) 359 4632 > PO Box 1645 Christchurch Email : john.carter@tait.co.nz > New Zealand > > Carter's Clarification of Murphy's Law. > > "Things only ever go right so that they may go more spectacularly wrong > later." > >> From this principle, all of life and physics may be deduced. > > > . > -- http://www.ruby-doc.org - The Ruby Documentation Site http://www.rubyxml.com - News, Articles, and Listings for Ruby & XML http://www.rubystuff.com - The Ruby Store for Ruby Stuff http://www.jamesbritt.com - Playing with Better Toys