"Kurt Stephens" <[EMAIL PROTECTED]> wrote: > I have recently developed a filter for HTML::Template, tentatively > named HTML::Template::wfXML, that modifies the syntax used > by the HTML::Template tagset in conformance with well formed > XML syntax.
it sure is nice to see that someone is doing this! there's been talk in the past about taking a stab at making H::T templates xml-parseable, but alas, no code :-) > ... The filter offers the following features: > > 1) The HTML::Template tags are represented as qualified names in > the 'tmpl' namespace. > > <TMPL_LOOP foo>...</TMPL_LOOP> > > becomes: > > <tmpl:loop foo>...</tmpl:loop> is that really well-formed? don't attribues *have* to have (quoted) values? i'd have thought it would have to become: <tmpl:loop name="foo">...</tmpl:loop> the same waay that <tmpl_var foo> becomes: <tmpl:var name="foo" /> > 2) I have added a TMPL_ATTR attribute as a synonym for TMPL_VAR > to allow dynamic attributes to be expressed in valid XML syntax. > > <html:img src="<TMPL_VAR foo>" /> > > becomes: > > <html:img tmpl:attr="src foo" /> interesting solution. the src="foo" attribute is valid for html::img -- have you though about using XML *entities* to represent tmpl_var output? could: <html:img src="<TMPL_VAR foo>" /> also be expressed simply as: <html:img src="&foo;"> /> no? i thought not :-) > 3) Empty template tags are terminated with '/>'. > > <TMPL_VAR name=foo> > > becomes: > > <tmpl:var name="foo" /> naturally. :-) > So far, the Perl module is complete and reasonably well tested, with the > POD documentation on the way. I am currently working on a DTD to > define the modified tags as an XHTML 1.1, module, or at least wading > through the XHTML 1.1 spec with the intentions of doing so ;-) i've waded through that swamp :-). make sure you bring hip boots! > ...I plan to submit an > alpha version to the SourceForge site when the docs and DTD are done. keep in mind that a DTD's are only used to define and test the "xml validity" of a document against a strict document type; they are by definition *not* required to test for well-formedness. a DTD defines (and strictly restricts) what tags can or must appear, in what order, within what containing tags, and what attributes those tags can or must have. while this can be great for highly structured and strictly formatted xml documents like, say an invoice or a database record, i wouldn't knock myself out trying to impose a DTD document type on every possible HTML::Template out there --- many are not even used to generate/template HTML! we use it to generate mail-merged plaintext emails and even Apache conf file! how would one define deterministically what tags (and only what tags) always are, can be, should be, must be and/or implicitly are in something as flexible and "loose" as the output of a generated H::T template? > ...Any comments or suggestions will be appreciated. is the code available for download anywhere else yet? need help with the docs? -dave --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
