cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject Re: CForms widget ID naming (was Re: [Vote] Releasing on friday)
Date Thu, 03 Nov 2005 09:34:42 GMT
Andreas Hochsteger wrote:
> (I think this should be discussed in a separate thread)
> Sylvain Wallez wrote:
>> The last minute change is just about replacing "-input" with ":input" 
>> within two XSLs, to avoid problems later.
> Isn't ":" used as separator for the namespace prefix?
> I don't know if this applies to IDs too, but perhaps we should 
> double-check before.

The ":" is a valid character in element names and ID and IDREF 
attributes (they are defined using the same grammar rule).

Parsers use the ":" in a special way for element names only, when 
namespace processing is activated (the default in all modern browsers)

> If it is allowed by the XML spec, it makes me wonder, if we want to 
> prefix the IDs some time in the future to use some kind of "namespace" 
> here too.

This usage in CForms has already been introduced by the recent library 
stuff, which associates prefixes to libraries, thus effectively 
forbidding the use of ":" in widget ids (otherwise you cannot 
differenciate between a widget name and a composite name that references 
a library widget).

That is why I chose this character. The "/" and "." are also forbidden 
(used for lookup paths). The "." cannot be used as it is used to combine 
widget names in the generated IDs, and thus would lead to a similar 
problem as the current one: "-" can conflict with siblings, and "." can 
conflict with children.

So the choice is between "/" and ":", but "/" is not allowed in XML 
names. Hence the result, ":"...

> Wouldn't this conflict with ":input" as you then cannot distinguish 
> between the two anymore (namespace prefix vs. ":input" suffix).

No, because as I said above, using ":" in widget names is effectively 
forbidden by the library prefix notation.

Another possibility is to prefix the name of generated-ids with ":" 
(this is allowed by the XML spec), e.g. ":foo-input" instead of 
"foo:input". But I prefer to keep the widget ID as the prefix of all 
that is related to its styling.

The rule is then: a styling stylesheed can generate whatever ID its 
needs for a widget by suffixing the widget's id with ":" followed by a 
name. Care should be taken of course that this name doesn't conflict 
with names produced by other stylesheets.

> Just some random thoughts ...
> Perhaps it would help to write something up which summarizes all the 
> IDs, names, prefixes, suffixes and namespaces involved in every part 
> of CForms.

Yup. That should be part of the documentation of the various stylings.


Sylvain Wallez                        Anyware Technologies
Apache Software Foundation Member     Research & Technology Director

View raw message