templatesnestedmatchgenshi

Genshi nested match templates


Ho do I make Genshi parse the output of a match template?

In other words:

I've got a template like this in Genshi:

<py:match path="gm:field">
    Something ${select('@label')}<br />
    ${select('*')}
    Something else<br />
</py:match>

When used directly:

<gm:field label="HERE">
    <b>Try this!</b>
</gm:field>

works perfectly:

Something HERE<br />
<b>Try this!</b>
Something else<br />

But when I try to define another one which delegates to it:

<py:match path="gm:input">
    <gm:field label="${select('@label')}">
        <input name="${select('@label')}" />
    </gm:field>
</py:match>

and call it:

<gm:input label="x">
    <input type="passwd" />
</gm:input>

The result I see in a browser is:

<gm:field label="x">
    <input label="x" />
</gm:field>

instead of:

Something x<br />
<input label="x" />
Something else<br />

which I would like to see...

I am using Genshi 0.5.1..


Solution

  • After looking into the source code I believe this cannot be done. Apparently nested match templates are not supported.