[ZPT] Processing instructions in HTML with ZPT
   
    Brad Clements
     
    bkc@murkworks.com
       
    Mon, 29 Oct 2001 11:54:14 -0500
    
    
  
I'm trying to inject <?IMPORT tags in HTML output for some Page Templates. 
Those templates that use this have a property named import_Namespace, which is a 
tokens type.
In my Master macro, I have this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html xmlns:ps xmlns:ts metal:define-macro="master">
<tal:xyz tal:omit-tag=""
         tal:condition="template/import_Namespace | nothing"
         tal:repeat="namespace template/import_Namespace">
<?IMPORT  
   tal:attributes="namespace python:string.split(namespace,':')[0];
                   implementation python:string.split(namespace,':')[1]">
</tal:xyz>
There are two problems:
1. I would like to be able to specify xmlns:ps and xmlns:ts in the HTML header based 
on some code that extracts these values from the import_Namespace property, 
however I couldn't figure out any way to do this with Page Templates. I thought of using 
a PythonScript to create a string "xmlns:ps xmlns:ts" but couldn't figure out any way to 
put that string in the <html> tag.
2. When tal:xyz repeat is processed, the <?IMPORT tag seems to be ignored, I get this 
output:
<html xmlns:ps xmlns:ts>
<?IMPORT  
   tal:attributes="namespace python:string.split(namespace,':')[0];
                   implementation python:string.split(namespace,':')[1]">
<?IMPORT  
   tal:attributes="namespace python:string.split(namespace,':')[0];
                   implementation python:string.split(namespace,':')[1]">
  <head>
What's the work around for this?
Brad Clements,                bkc@murkworks.com   (315)268-1000
http://www.murkworks.com                          (315)268-9812 Fax
netmeeting: ils://ils.murkworks.com               AOL-IM: BKClements