Re: Re: [Zope-xml] Is there an easy way of using DocBook documents in Zope yet?

Craeg K Strong <[email protected]> Thu, 29 Aug 2002 19:09:33 -0400
Newsgroups gmane.comp.web.zope.parsed-xml
Organization Ariel Partners LLC
Message-ID <[email protected]>
See comments embedded below:

Karl Anderson wrote:
> Craeg K Strong <[email protected]> writes:
> 
> 
>>So if your docbook format XML document was contained in
>>a ParsedXML object called foo, you would create a DTMLDocument
>>called, for example, bar with the contents:
>>
>><dtml-var expr="foo.index_html()">
>>
>>And then list "bar" as the sourceID of the XMLTransform.
>>
>>A bit clunky, but it works!   I am hoping the authors of
>>ParsedXML add a __call__() method in their next release
>>that does the same thing as index_html()
>>which would obviate the extra DTMLDocument step.
> 
> 
> Well, to be Zopish, XSLTransform should try index_html if __call__
> isn't there (actually, before __call__).  And to be flexible,
> XSLTransform should let you specify the method used to get XML from the
> source and sheet object(s), so you can feed it objects for which XML
> isn't their main reason for living (ZDOM, StructuredText, whatever).

OK. Let me repeat back to you what I think I heard:

The Source ID should accept either a Zope ID

or a Python expression of the form "Zope ID".method()

So you could enter things like:

foo
foo.index_html()
bar.getDOMObj().serialize("ascii")

Hmmm.  Maybe what I do is simply treat the result as an
expression and see if it evaluates to a well-formed XML document?

But I still have to put in "magic" such that if I get only a bare
object ID ("foo" above) I have to append ".index_html()" to it.

OK.  That shouldn't be too hard.  I will put it in the Todo.

> 
> Anyway, unless you're caching, you don't want to render the top
> ParsedXML object if you're using it in plumbing, because that's
> expensive.  You want to get the proxied DOM object with getDOMObj()
> and render that.
> 

XMLTransform supports caching, but with the above capabilities you
could do it however you wanted.

--Craeg