|
List Info
Thread: xi:include problem
|
|
| xi:include problem |

|
2007-10-15 03:59:27 |
Hi there,
I'm trying to use <xi:include> in an XML template but
it doesn't seem
to be working. I have the following in my main template:
<artist xmlns:py=".." xmlns i=&qu
ot;http://www.
w3.org/2001/XInclude">
...
<web-resources>
<xi:include href="sub-web-resource.xml"
py:for="r in related_records(artist_id,
tables=['resources'])" />
</web-resources>
and in "sub-web-resources.xml" I have:
<?xml version="1.0" encoding="utf-8"
?>
<web-resource id="${r['id']}"
uri="${r['uri']}">
<predicate>${r['predicate']}</predicate>
<name>${r['title']}</name>
<role>${r['role']}</role>
<?python
cur.execute("SELECT uri FROM resources WHERE
resource_id='%s'" %
r['id'])
res = cur.fetchone()
?>
<uri py:if="res['uri'] is not
None">${res['uri']}</uri>
</web-resource>
What happens is that I get no result. The resultant XML
includes the
<web-resources> container element but it contains a
single blank line.
I get no error message.
I've tried a couple of different paths for the href value
(including
the absolute path).
I've also tested the sub-template without xi:including it
and it works
fine. And I've tried re-factoring the xi:include so that the
<web-
resources> element and the py:for directive are in the
sub-template
instead - in which case (as expected) I don't even get the
<web-
resources> container element.
Any ideas why this isn't working?
I'm using Genshi 0.4.4 with Python 2.4.4 both packaged for
Debian
('unstable').
Cheers,
Richard
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Genshi" group.
To post to this group, send email to genshi googlegroups.com
To unsubscribe from this group, send email to
genshi-unsubscribe googlegroups.com
For more options, visit this group at http://gr
oups.google.com/group/genshi?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: xi:include problem |

|
2007-10-15 05:36:50 |
In fact, if I try to xi:include a sub-template using a
file-name that
doesn't exist, I get exactly the same result: no error
message and the
<xi:include> substituted with a blank line.
:-(
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Genshi" group.
To post to this group, send email to genshi googlegroups.com
To unsubscribe from this group, send email to
genshi-unsubscribe googlegroups.com
For more options, visit this group at http://gr
oups.google.com/group/genshi?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: xi:include problem |

|
2007-10-15 05:59:23 |
On 10/15/07, Richard Lewis <pycoon googlemail.com> wrote:
> In fact, if I try to xi:include a sub-template using a
file-name that
> doesn't exist, I get exactly the same result: no error
message and the
> <xi:include> substituted with a blank line.
Have you specified a template loader? To do so you'll need
to create
the template using something like:
from genshi.template import MarkupTemplate,
TemplateLoader
oLoader = TemplateLoader([paths to search for xi:includes
in])
oTemplate = MarkupTemplate(sTemplate,loader=oLoader)
where sTemplate is the template source.
Schiavo
Simon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Genshi" group.
To post to this group, send email to genshi googlegroups.com
To unsubscribe from this group, send email to
genshi-unsubscribe googlegroups.com
For more options, visit this group at http://gr
oups.google.com/group/genshi?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: xi:include problem |

|
2007-10-15 06:10:14 |
On Oct 15, 11:59 am, "Simon Cross"
<hodges... gmail.com> wrote:
>
> Have you specified a template loader? To do so you'll
need to create
> the template using something like:
>
> from genshi.template import MarkupTemplate,
TemplateLoader
>
> oLoader = TemplateLoader([paths to search for
xi:includes in])
> oTemplate = MarkupTemplate(sTemplate,loader=oLoader)
>
> where sTemplate is the template source.
Aha. That seems to have fixed it. I hadn't realised there
was even
such a thing as a TemplateLoader. I should really read the
documentation more carefully.
Thanks for your help.
Cheers,
Richard
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Genshi" group.
To post to this group, send email to genshi googlegroups.com
To unsubscribe from this group, send email to
genshi-unsubscribe googlegroups.com
For more options, visit this group at http://gr
oups.google.com/group/genshi?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: xi:include problem |

|
2007-10-15 06:26:16 |
On Oct 15, 12:10 pm, Richard Lewis <pyc... googlemail.com> wrote:
>
> I hadn't realised there was even
> such a thing as a TemplateLoader. I should really read
the
> documentation more carefully.
>
I'm not sure how to edit the Genshi Wiki, but I wonder if it
may be
worth adding something about using TemplateLoader to this
section:
http://genshi.edgewall.org/wiki/Docum
entation/0.4.x/xml-templates.html#id10
It could be appended to the bottom of the paragraph which
begins
"Include paths are relative to...".
Cheers,
Richard
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Genshi" group.
To post to this group, send email to genshi googlegroups.com
To unsubscribe from this group, send email to
genshi-unsubscribe googlegroups.com
For more options, visit this group at http://gr
oups.google.com/group/genshi?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: xi:include problem |

|
2007-10-15 06:10:14 |
On Oct 15, 11:59 am, "Simon Cross"
<hodges... gmail.com> wrote:
>
> Have you specified a template loader? To do so you'll
need to create
> the template using something like:
>
> from genshi.template import MarkupTemplate,
TemplateLoader
>
> oLoader = TemplateLoader([paths to search for
xi:includes in])
> oTemplate = MarkupTemplate(sTemplate,loader=oLoader)
>
> where sTemplate is the template source.
Aha. That seems to have fixed it. I hadn't realised there
was even
such a thing as a TemplateLoader. I should really read the
documentation more carefully.
Thanks for your help.
Cheers,
Richard
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Genshi" group.
To post to this group, send email to genshi googlegroups.com
To unsubscribe from this group, send email to
genshi-unsubscribe googlegroups.com
For more options, visit this group at http://gr
oups.google.com/group/genshi?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: xi:include problem |

|
2007-10-15 06:26:16 |
On Oct 15, 12:10 pm, Richard Lewis <pyc... googlemail.com> wrote:
>
> I hadn't realised there was even
> such a thing as a TemplateLoader. I should really read
the
> documentation more carefully.
>
I'm not sure how to edit the Genshi Wiki, but I wonder if it
may be
worth adding something about using TemplateLoader to this
section:
http://genshi.edgewall.org/wiki/Docum
entation/0.4.x/xml-templates.html#id10
It could be appended to the bottom of the paragraph which
begins
"Include paths are relative to...".
Cheers,
Richard
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Genshi" group.
To post to this group, send email to genshi googlegroups.com
To unsubscribe from this group, send email to
genshi-unsubscribe googlegroups.com
For more options, visit this group at http://gr
oups.google.com/group/genshi?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
[1-7]
|
|