Codesample for xml/xslt transforming
John J. Lee
jjl at pobox.com
Tue Sep 9 20:43:47 CEST 2003
axel at pizza.home.kosnet.com (Axel Straschil) writes:
> > BTW, I used to waste a lot of time with xslt.
> Jep, hard work for eight lines:
> from Ft.Lib.Uri import OsPathToUri
> from Ft.Xml import InputSource
> from Ft.Xml.Xslt.Processor import Processor
> STY = InputSource.DefaultFactory.fromUri('test.xsl')
> SRC = InputSource.DefaultFactory.fromUri('test.xml')
> proc = Processor()
> print proc.run(SRC)
That looks like Python code to me, Axel, not XSLT <wink>. It's
writing the XSLT that's the pain, not interpreting it (though that can
certainly be 'arbitrarily difficult' -- in the words of K&R, IIRC --
if the XSLT implementors have hidden the command-line utility well
The utility of XSLT is that everybody can agree to hate it equally
<0.3 wink>. If the world were saner, we'd all agree to *like* Python
equally, but there you go.
(actually, I don't hate it in itself -- just the way people view it as
being particularly useful, which seems unjustified)
> > I think you are most of the time quicker with SAX for
> > parsing XML and "print" to create XML.
> It's for an CMS-System. I think XML and XLST is a good thing
> if programmer and webdesigner have to work together, and you
> realy want to seperate the content from the design
> (Even when I think god had a bad day when he craeted
> webdesigner ;-).
XML is good because it's an widely-understood, easy-to-read,
not-to-complicated, *non*-loathesome standard that gets the job done.
XSLT... well, it's a standard. And it has an 'X' in the name, of
course, which is the killer feature <wink>.
More information about the Python-list