[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Should attributes be prefixed


doug ransom
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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.