Re: Processing instruction guidelines
At 2003-01-23 16:07 +0000, Jeni Tennison wrote: >I'm trying to put together some guidelines about when we should use >processing instructions and when some other construct (e.g. empty >element, namespaced attribute) to pass information to an application. My rule of thumb is to use PIs to talk about the information in an XML document without "interfering" with the information in the XML document. My editing environment includes a spell-check facility. The fact that a word needs to be ignored because it isn't in the spell-check dictionary isn't an aspect of the information in my document: I will still format the document or process the document regardless of whether the word is spelled correctly or not. But, during editing time, it *is* important to escape the word explicitly so that I get a clean spell check. So I use <?no-spell start?> and <?no-spell end?> around the text that isn't to be checked ... and the editing environment protects such sequences. This is in keeping with the name: I am giving instructions to the processor of my information that are specific to one (maybe more) processors, but not disturbing the integrity of the document or polluting the structure of my information with something that is important to the processor and not me. >Also, are there any guidelines about naming the targets of PIs? The >ones that I've seen tend to use a naming scheme "prefix-localPart" >where the prefix is used to indicate the authority or application >involved and the local part is used to specify the name of the >instruction itself. Is that fairly standard? That "feels" too much like a namespace which wouldn't have worked outside the document element. >Despite the fact that the XML Rec. suggests using notations to specify >the legal names of PIs, I haven't actually seen that in use. Anyone >think that it's good practice? That interesting aspect about PIs in XML wasn't in SGML: the mapping of the PI target to an application through the NOTATION declaration. If XSLT had given us access to NOTATION information from the DTD I would probably be using more PIs experimentally to see what other uses there are. If the NOTATION machinery were in place, the name would become irrelevant and we would get the namespace-prefix-like independence. I'm a big fan of namespaces and would have supported this strongly ... but without having it in the first processing environment for XML (XSLT), there was no opportunity to promote it. >What about PI data? Most PIs that I've seen use pseudo-attributes, I >guess for extensibility. Is that standard practice? I've avoided name="value" since that would require me to do more parsing than having positional parameters ... so in my own work I've just used positional. I hope this helps. ....................... Ken -- Upcoming hands-on in-depth Europe: February 17-21, 2003 XSLT/XPath and/or XSL-FO North America: June 16-20, 2003 G. Ken Holman mailto:gkholman@C... Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) ISBN 0-13-065196-6 Definitive XSLT and XPath ISBN 0-13-140374-5 Definitive XSL-FO ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath ISBN 1-894049-10-1 Practical Formatting Using XSL-FO Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc
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