[Twisted-web] Re: [Nevow-commits] Replace ID generator values with IDs based on context.key. Group
James Y Knight
twisted-web@twistedmatrix.com
Mon, 1 Mar 2004 20:13:24 -0500
On Feb 29, 2004, at 6:19 PM, mg CVS wrote:
> +def keyToXMLID(key):
> + """Convert a key into an XML-style ID """
> + if not key:
> + print 'keyToXMLID: no key, but why?'
> + return None
> + return '-'.join(key.split('.'))
Did you run into a specific problem forcing the translation of . to -?
The HTML spec says:
- ID and NAME tokens must begin with a letter ([A-Za-z]) and may be
followed by any number of letters, digits ([0-9]), hyphens ("-"),
underscores ("_"), colons (":"), and periods (".").
The XHTML spec seems to be even more open, allowing many many
characters to be used in names. It says you should only use names
matching [A-Za-z][A-Za-z0-9:_.-]* if you want to be compatible with
HTML4.
James