Re: Allowed characters in element id's

Subject: Re: Allowed characters in element id's
From: Tony Graham <tgraham@xxxxxxxxxxxxxxxx>
Date: Thu, 30 Apr 1998 12:39:34 -0400 (EDT)
At 30 Apr 1998 10:13 CDT, Bill Raynor wrote:
 > How do I determine what's allowed in an id= attribute? I'd like to use
 > underscores and periods but jade gets upset about extraneous punctuation
 > marks in the id. I'm generating the sgml from another system and would
 > like to take give the elements an easy to read name.

Unfortunately, it's not something you can work out without some SGML
background knowledge.  The short answer is that the first character
must be a letter, and any other characters may be a letter, a digit,
".", or "-".

The long answer is that it's determined by the rules of SGML and by
what's in your SGML Declaration.  The characters allowed in an ID are
those allowed in an SGML "NAME".  By default, the first character must
be a letter, and any other characters may be a letter or a digit.

You can add to this by specifying the additional characters in your
SGML Declaration (and you can't take any characters away).  The
convention in widest use is that of the "Reference concrete syntax"
included in the SGML standard itself that adds "." and "-" as "name"
characters (but not as "name start" characters).  This is what's used
in the DocBook SGML Declaration, docbook.dcl.  The relevant portion
is:

------------------------------------------------------------
	NAMING
		LCNMSTRT ""
		UCNMSTRT ""
		LCNMCHAR ".-"
		UCNMCHAR ".-"
		NAMECASE
			GENERAL YES
			ENTITY  NO
------------------------------------------------------------

The NAMING portion specifies both uppercase and lowercase forms of the
additional "name start" and "name" characters (since names are folded
to uppercase when the "GENERAL" parameter has the value YES").

 > Is this something that can be changed, or is that not a wise thing to do?

It can be changed by modifying your SGML Declaration, but doing so may
hinder exchanging your documents with anybody else.  Right now, you
can send your DocBook documents to anybody else and they can use them
(or you may need to send your customization DTD along as well), but if
you modify your SGML Declaration, the person receiving your documents
will have to have the modified SGML Declaration as well and be set up
to use it, otherwise they'll get the error messages about the
erroneous characters.

Regards,


Tony Graham
=======================================================================
Tony Graham
Mulberry Technologies, Inc.                         Phone: 301-315-9632
17 West Jefferson Street, Suite 207                 Fax:   301-315-8285
Rockville, MD USA 20850                 email: tgraham@xxxxxxxxxxxxxxxx
=======================================================================


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread
  • Re: Allowed characters in element id's, (continued)
    • Norman Walsh - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id LAA24496Thu, 30 Apr 1998 11:41:50 -0400 (EDT)
      • Bill Raynor - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id MAA25255Thu, 30 Apr 1998 12:00:16 -0400 (EDT)
    • Henry Thompson - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id LAA24863Thu, 30 Apr 1998 11:50:37 -0400 (EDT)
    • Chuck Darney - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id MAA25493Thu, 30 Apr 1998 12:08:36 -0400 (EDT)
    • Tony Graham - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id MAA26656Thu, 30 Apr 1998 12:46:46 -0400 (EDT) <=
      • Bill Raynor - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id NAA27831Thu, 30 Apr 1998 13:51:15 -0400 (EDT)
    • W. Eliot Kimber - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id MAA25492Thu, 30 Apr 1998 12:08:35 -0400 (EDT)
    • W. Eliot Kimber - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id OAA28591Thu, 30 Apr 1998 14:31:11 -0400 (EDT)