Attributes with Intent

Peter Murray-Rust peter at ursus.demon.co.uk
Mon May 4 16:23:25 BST 1998


At 08:33 04/05/98 -0400, David Megginson wrote:
>Peter Murray-Rust writes:
>
>
>From a logical perspective, your query is simply
>
>  Find all elements in a document where the element or the nearest
>  ancestor with a value for the xml:lang attribute specifies "de" as
>  the attribute's value.

Absolutely. And with the tools I have written it's trivial (for me). And
for those who have SQDL implementations, it's trivial as well. And so on.
But for the newcomer to XML this is a major concern that they have to address.
>
>With SDQL, for example, this test is surprisingly simple:
>
>  (equal? (inherited-attribute-string "xml:lang") "de")
>
>Your point is well-taken, though: fragments of XML documents are often
>tightly bound to their context (similar situations would involve
>attributes for effectivity, security level, revision status, etc.).

The real point is that X*L/W3C approaches require *almost any* application
writer to implement this. If I have to write
>
  (equal? (inherited-attribute-string "xml:lang") "de")

or (as I do)
  String lang =
(currentNode.getXPointerNode("ANCESTOR(1,*,xml-lang,*)").getAttributeValue("
xml:lang"));

it would be nice if we all had a consistent way of doing it.

Whatever the solution it appears that processing links is significantly
more effort because of this. Respecting confidentiality, I may or may not
have made this point on XML-SIG but the decision has been taken and we have
to find the best way of implementing it. The software not only has to
search for (say) those elements with (say) role attributes, but those which
are 'intended' to have role elements.

It gets more fun with attribute remapping:

<!ATTLIST molecule 
	xml:attributes  CDATA #FIXED "role new-role">

which says that wherever you encounter the attribute "my-role" in a
<molecule> it is *really* a 'role' attribute. So we have:

<reaction xml:link="extended" new-role="reactant">
<molecule xml:link="locator" href="mol1.xml"/>
</reaction>

What is the 'role' of the <molecule>?  [BTW it matters getting this right,
since if you get the wrong reactants there might be an unexpected
exothermic reaction.]

Implementer 1 says:
"map all molecule|new-role to behave like molecule|role"
"make all locator molecules inherit the value of the parent roles (after
mapping"

Implementer 2 says:
"make all locator molecules inherit the value of the parent roles (without
mapping)"

I suspect I side with 2, but can I be sure that everyone sees it that way? 

In any case there will be lots of times that we want an attribute from an
element. For certain types of element/attribute we may have to ask:
	- give me the attributes
	- does this also have some 'intended attributes'
	- oh, and does it also have some attributes which are mapped by yet
another level of indirection?

The only way that I can see myself offering reliable software is if we
agree communally on what the semantics of this are *and* implement some
software/APIs to help ensure consistency. For the present I suspect I shall
say:
	JUMBO does not support attribute remapping. Sorry.

	P.





Peter Murray-Rust, Director Virtual School of Molecular Sciences, domestic
net connection
VSMS http://www.nottingham.ac.uk/vsms, Virtual Hyperglossary
http://www.venus.co.uk/vhg

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list