[Zope3-Users] Literal double quoted string within single
quoted attribute in ZPT
Marius Gedminas
mgedmin at b4net.lt
Mon Jan 28 13:04:01 EST 2008
On Sun, Jan 27, 2008 at 01:08:09PM -0500, Stephan Richter wrote:
> On Monday 17 December 2007, David Pratt wrote:
> > Hi. Is there solution for create a single quoted attribute using
> > tal:attributes containing literal double quoted items. I am using a
> > python method for generating the string. I understand structure will
> > unquote but it does not work with an attribute.
>
> Well, attributes must always be quoted based on the XML spec, right. Otherwise
> TAL could produce invalid XML. What does the spec actually say about this?
XML 1.0 spec says this:
Attribute ::= Name Eq AttValue
AttValue ::= '"' ([^<&"] | Reference)* '"'
| "'" ([^<&'] | Reference)* "'"
In other words, you can use either double quotes or single quotes.
References:
http://www.w3.org/TR/REC-xml/#dt-stag
http://www.w3.org/TR/REC-xml/#NT-AttValue
XML 1.1 spec says the same:
http://www.w3.org/TR/xml11/#dt-stag
http://www.w3.org/TR/xml11/#NT-AttValue
HTML 4 spec agrees:
http://www.w3.org/TR/html401/intro/sgmltut.html#h-3.2.2
> > I see there is a new
> > z3c.tal package based on lxml. Will I have to go as far as customizing
> > tal to do this? I realize this may be best on the zpt list but it it
> > rarely if ever used these days. Many thanks.
>
> Well, if the XML specification allows for your output, we could consider it
> not working this way a bug.
Why? A missing feature, surely, but why would generating attr="""
instead of attr='"' be considered a bug?
> However, it would make the code much more
> complicated, I think (unless we support structure as well in this case).
Marius Gedminas
--
Despite all appearances, your boss is a thinking, feeling, human being.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20080128/c2a5f87c/attachment.bin
More information about the Zope3-users
mailing list