[ZPT] Generating XML documents in ZPT

Philip Kilner phil at xfr.co.uk
Mon Aug 16 04:22:56 EDT 2004


Hi Dieter,

Dieter Maurer wrote:
>>- For consistency, I set the mime type of the ZPT to "text/xml" as 
>>opposed to "text/html" - but this caused the template source to be rendered!
> 
> What does "the template source were rendered" mean?
> 

It means that when I call my template, I see: -

<GUID>
<span tal:replace="RequestRecord/GUID">GUID</span>
</GUID>

...instead of the expected: -

<guid>DC1FCC1A-669F-4C4A-8789-098461402D55</guid>

...e.g. I'm seeing the source rather than the output of the TAL statements.

>>- The element names are mixed case in the ZPT, but in the rendered 
>>document seem to be converted to lower-case (which throws a spanner in 
>>the works at the other end, where the document is parsed). Needless to 
>>say, because of the first point this is when the document has an HTML 
>>mime type - might it behave as expected if I can fix the mime type?
> 
> 
> HTML specifies that elements and attribute names are case insensitive.
> The easiest way to garantee that is to perform a case normalization.
> 

That was how I understood it to work, so when the document type is HTML 
this is of no concern. BTW, having done some more googling, under 
"lowercase" rather than "lower case" or "lower-case" (!), I see that 
there is a bug report in the collector about this, although it's a bit 
ambiguous.

> When the "content_type" is "text/xml", the normalization should
> no longer happen (as XML is case sensitive).
> 

However, I don't understand why when I call my document when the type is 
set to XML, I'm seeing the source of the ZPT rather than the expected 
output.

I've got the feeling I'm missing something obvious here - fortunately, 
in this case the XML is so simple I could hard-code it all in Python if 
needs be, but I'd rather learn from what is going on here.

-- 

Regards,

PhilK

Email: phil at xfr.co.uk / Voicemail & Facsimile: 07092 070518

"The lyf so short, the craft so long to learne" - Chaucer



More information about the ZPT mailing list