[XML-SIG] Functional interface to XML?
Mon, 15 Feb 1999 20:40:10 -0600
Paul Prescod wrote:
> First, why not generate SAX events and then use your existing DOM builder
> to make the formatting object tree. That way you would be able to daisy
> chain XSL filters and other filters.
I guess in a sense, we really do use events to generate the tree, however just
1, match. I have defined a bunch of the templates as extensions to the element
node. These are put into a tree by a XSL builder. The XSL templates then match
(the one event) based on the hierachy of the XSL tree. Each template
implementation returns a list of FO objects that are the result of doing the
match. Each template also calls the match on any of its children that are XSL
objects (Which will be all of the children)
> Second, is the API such that some of the facilities are useful from
> Python? For instance can you easily look up nodes given a pattern, or do
> an XSL pattern-based "visit" of a node tree?
What do you mean useful from python?
The patterns are completely different entities then the templates. You can have
a pattern, and call its match method giving it a node. It will return either a
list of nodes, or a boolean value (depending on what type of pattern it is).
This could easily be used to create a pattern based visitor/filter.
> I'm not sure if it is clear what I am getting at. XSL processing could be
> regarded as a special case of "pattern-based tree visiting." That might
> allow us to use an XSL visitor pattern in ordinary Python code.
I am confused when you say "ordinary Python code". Do you mean outside of the
realm of DOM/XML/XSL?
"No program is interesting in itself to a programmer. It's only interesting as
as there are new challenges and new ideas coming up." --- Linus Torvalds