I've recently been experimenting with KID templates and have been
having troubles.

I like how the templates are setup from the quickstart which is also
documented here:
http://lesscode.org/projects/kid/wiki/LayoutTemplateRecipe

Having some trouble adding my own match tempaltes to it though:

============ master.kid ============
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<?python import sitetemplate ?>
<html xmlns="http://www.w3.org/1999/xhtml";
xmlns:py="http://purl.org/kid/ns#"; py:extends="sitetemplate,
'extras.kid'">

<head py:match="item.tag=='{http://www.w3.org/1999/xhtml}head'">
    <meta content="text/html; charset=UTF-8" http-equiv="content-type"
py:replace="''"/>
    <title py:replace="''">Your title goes here</title>
    <link py:strip="1" py:for="css in tg_css">${css.insert()}</link>
    <link py:strip="1" py:for="js in tg_js_head">${js.insert()}</link>
    <meta py:replace="item[:]"/>
</head>

<body py:match="item.tag=='{http://www.w3.org/1999/xhtml}body'">
    <div py:strip="1" py:for="js in tg_js_bodytop">${js.insert()}</div>
    <p align="center"><img
src="http://www.turbogears.org/tgheader.png"/></p>

    <div py:if="tg_flash" class="flash" py:content="tg_flash"></div>
    <div py:replace="item[:]"/>
    <div py:strip="1" py:for="js in
tg_js_bodybottom">${js.insert()}</div>
</body>
</html>

============ welcome.kid: ============
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";
xmlns:py="http://purl.org/kid/ns#";
    py:extends="'master.kid'">

<head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type"
py:replace="''"/>
    <title>Welcome to TurboGears</title>
</head>

<body>
  <strong py:match="item.tag == 'b'"
    py:content="item.text.upper()" />

  <p>My Main page with <b>bold</b> text</p>
</body>
</html>

====================================

So both tempaltes are pretty much vanilla from the quickstart. My match
template (replaces <b> with <strong> tag and upercases the text) does
nothing. However if I remove xmlns="http://www.w3.org/1999/xhtml"; from
the welcome.kid <html> tag, my match tag works fine but of course the
master template stops working.

In an ideal world I would like the master template to inherit
(py:extends) from another template that defines a number of match and
named tempalte items, but I can't even get this basic functionality
working. Most likely this problem is filled with many other PEBCAKs

Using TurboGears 0.9a from SVN
-Owen <><

Reply via email to