[ZPT] Metal 1.1 Macro Extension example is screwy
Brad Clements
bkc at murkworks.com
Sat Feb 11 16:30:33 EST 2006
I am trying to implement metal 1.1 in tal2xslt. I think I have it correct.
However this URL:
http://www.zope.org/Wikis/DevSite/Projects/ZPT/MacroExtension
Gives an example that is malformed. The T2 macro mentions </block> but
there's no opening <block>.
And the final output also shows </block> in a few places, but no opening
<block>
My feeling is that T2's define-slot=D should not appear in the output,
since T3 provides a fill-slot=A, which I believe should entirely replace
the contents of T2's define-slot=A
Here are my input files, in case anyone cares to remark:
t1.xml
<?xml version="1.0" ?>
<div xmlns:metal="http://xml.zope.org/namespaces/metal"
metal:define-macro="base">
<div metal:define-slot="A">default A filler</div>
<div metal:define-slot="B">default B filler</div>
<div metal:define-slot="C">default C filler</div>
</div>
t2.xml
<?xml version="1.0" ?>
<div xmlns:metal="http://xml.zope.org/namespaces/metal"
metal:define-macro="extension"
metal:extend-macro="t1.xml#base">
<div metal:fill-slot="A">
slot A decoration from T2
<div metal:define-slot="A">
overridden A filler
<div metal:define-slot="D">default D filler</div>
</div>
</div>
</div>
t3.xml
<?xml version="1.0" ?>
<div xmlns:metal="http://xml.zope.org/namespaces/metal"
metal:use-macro="t2.xml#extension">
<div metal:fill-slot="A">final slot A filler</div>
<div metal:fill-slot="C">final slot C filler</div>
<div metal:fill-slot="D">final slot D filler</div>
</div>
and the libxml output run:
<?xml version="1.0"?>
<div xmlns:metal="http://xml.zope.org/namespaces/metal"
metal:use-macro="extension">
<div metal:fill-slot="A">
slot A decoration from T2
<div metal:fill-slot="A">final slot A filler</div>
</div>
<div metal:define-slot="B">default B filler</div>
<div metal:fill-slot="C">final slot C filler</div>
</div>
This doesn't match the example output from the MacroExtension URL page,
but then, the input files don't match exactly either.
(oh, is it bad form to copy fill-slot and define-slot to the output? I
think it's handy for debugging, but I see extended-macro makes it look
confusing)
More information about the ZPT
mailing list