|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Element ID's versus namespaces
At 99/11/24 20:41 -0500, Paul W. Abrahams wrote:
Sec. 5.2.1 of the XPath spec says that an element may have a unique identifier (ID), which is the value of the attribute that is declared in the DTD as type `ID'. That implies that a document using IDs must have a corresponding DTD. But you do not need to have an *entire* DTD. You can have an internal declaration subset informing the processor of the ID type of a given attribute ... this is done a *lot* with XSLT because of the dependency of some document types on ID typed attributes for precisely what you have cited. Here are two examples I illustrate in my training material: - an element is considered to have unique identifier if it has an
attribute node that is considered an attribute of XML type ID
only when the source file has a document model whose
declaration for the attribute is of type ID
- in a well-formed document without a complete DTD it is
sufficient to add only an attribute list declaration for the
attribute in question as in these examples: <!DOCTYPE prodsummary [
<!ATTLIST prod id ID #REQUIRED>
]>and <!DOCTYPE custsummary [
<!ATTLIST cust custNbr ID #REQUIRED>
]> - note that there is no special meaning conferred on
attributes named "id", only on attributes of type "ID"However, namespaces are tightly integrated into XPath also, and it seems to be almost impossible in any practical sense to compose a DTD for a document that derives its names from multiple namespaces. For a *complete* DTD, I agree ... but it is not well known that a well-formed XML instance can include significant declarations. That seems to be the gist of a lot of discussion in xmldev not long ago. My reply above is edited from a discussion on XML-L. So how is this conflict being resolved in the real world? By declaring which attributes in a well-formed instance are to be regarded as being of type ID so the XSLT processor will know which attribute specifications to use when assigning a unique identifier to an element node. I hope this helps. ................... Ken -- G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995) Web site: XSL/XML/DSSSL/SGML services, training, libraries, products. Practical Transformation Using XSLT and XPath ISBN 1-894049-03-9 Next instructor-led training: 1999-12-05/06, 1999-12-07, - 2000-02-27/28, 2000-05-11/12, 2000-05-15 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








