[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Should attributes be prefixed
Uh oh, here we go again. I like to follow the convention that XSLT uses: when attributes are "owned" by the element, don't put it in a namespace. It's already sufficiently scoped by the owner element. For example: <xsl:element name="foo" use-attribute-sets="bar"/> But when you want to use an attribute on "someone else"'s element, i.e. in a different namespace (for example, in XSLT, on a literal result element), then put your attribute in your namespace so as to distinguish it from an attribute owned by that element. For example: <myElement myAttribute="lala" xsl:use-attribute-sets="bar"/> The upshot is that attributes aren't usually in a namespace, except in special cases like these. This isn't the only approach. (See subsequent flames.) Evan Lenz XYZFind Corp. -----Original Message----- From: Doug Ransom [mailto:Doug.Ransom@p...] Sent: Tuesday, November 20, 2001 1:17 PM To: Xml-Dev@Lists. Xml. Org (E-mail) Subject: Should attributes be prefixed When should attributes be prefixed and included in a namespace, and when should attributes reside globally. i.e. global attribute <V units="Volts" xmlns="mailto:Doug.Ransom@p..."/> vs attribute in the namespace <p:V p:units="Volts" xmlns:p="mailto:Doug.Ransom@p..."/> In both cases, the units value must exist within the V element for the element to be valid. Doug Ransom Software Engineer/Internet Technologies Domain Lead Power Measurement mailto:Doug.Ransom@p... tel:250-652-7100 x 7558 fax:250-652-0411 Request My VCard
|
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
|