[ZPT] [Weakness] "tal:repeat" not yet right
Dethe Elza
delza@alliances.org
Mon, 22 Oct 2001 10:32:40 -0700
I just wanted to clarify what Tone said about XML processing
instructions. A processing instruction is XML syntax for passing
information (instructions) through the parser to the receiving program.
This is handy for scripting, templating, etc. So handy that Tim Bray,
co-editor of the XML specification, called them "the yellow stickies" of
XML.
There is only one processing instruction (that I'm aware of) which has
been defined by the W3C, for including style sheets:
<?xml-stylesheet href="my-style.css" type="text/css"?>
There are other pseudo-attributes available, and the stylesheet could be
XSLT instead of CSS, but that's the basic version. This PI (processing
instruction) is used in XML the way the <link /> tag is used in HTML, to
incorporate an external stylesheet.
See here for more on associating style sheets with XML:
http://www.w3.org/TR/xml-stylesheet/
Tone mentioned that the start of an xml file, "<?xml version="1.0"?>" is
a PI, but that's not the case. It *looks* like a PI, and it follows the
same syntax as a PI, but it's actually the XML Declaration, and it's the
only beast of it's kind, although it does follow the same syntax as a PI.
That syntax is tricky, because most PIs look a lot like XML start tags:
they have a name, some attribute-like things, a beginning and an end.
But the spec only defines the open and closing tags, the name, and
undistinguished "content."
<?myPI AwholebunchOfContentWhichMayOrMayNotLookLikeAttributes?>
The content is associated with the name and passed through the parser as
a whole.
Because in most cases PIs are used a lot like XML Elements, that is,
they have attribute-like constructions, that these are now called
pseudo-attributes. In the following, the pseudo-attributes are "first"
and "second":
<?myPI first="Something" second="something else"?>
Finally, Tone recommended that we create a new PI to flag state in
TALES. That's perfectly legal and a good use of PIs, but we can't start
it with "<?xml". All tags and PIs beginning with "xml" are reserved by
the W3C for future use, and doing so would make it look like the XML
declaration and likely cause the poor parser to choke. So we'd be
better off something like:
<?tal-ourFlag value="true"?>
or
<?tal:ourFlag value="true"?>
Note that the second isn't really using XML namespaces, since the
Namespaces doc doesn't mention PIs at all. Probably the first one would
be recommended, since it avoids questions of namespace. On the other
hand, we can, as Godefroid recommmended, simply put the flag value into
the TALES statement directly and avoid PIs altogether.
In that case, as Emily Latella so aptly put it, "Never mind."
--Dethe
--
Dethe Elza (delza@burningtiger.com)
Chief Mad Scientist
Burning Tiger Technologies (http://burningtiger.com)
Living Code Weblog (http://livingcode.ca)