aliasing elements

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

aliasing elements

Jim Jewett

Is there any way to alias an element or attribute from another namespace?

This immediate spur of this question is that the XHTML 2.0 draft is
struggling with xml:id

http://www.w3.org/TR/xhtml2/mod-core.html#col_Core

At the moment, it defines both id and xml:id, but says not to use them
on the same element.  I believe what they really want is to say is
closer to:

xml:id is a core attribute.  id is just an alias for xml:id.  It is
not merely similar, or a second copy; it is the same attribute, so
only one of the two names can be used on any given element.

I believe that xml:lang and xml:base are similar, and there is a
chance that aliasing could help resolve some of the problems with
xlink.

-jJ

Reply | Threaded
Open this post in threaded view
|

Re: aliasing elements

G. Ken Holman

At 2006-08-16 14:38 -0400, Jim Jewett wrote:
>Is there any way to alias an element or attribute from another namespace?

Processing applications can implement an
"aliasing" concept, but there is no such concept in markup definition.

>This immediate spur of this question is that the XHTML 2.0 draft is
>struggling with xml:id
>
>http://www.w3.org/TR/xhtml2/mod-core.html#col_Core
>
>At the moment, it defines both id and xml:id, but says not to use them
>on the same element.  I believe what they really want is to say is
>closer to:
>
>xml:id is a core attribute.  id is just an alias for xml:id.  It is
>not merely similar, or a second copy; it is the same attribute, so
>only one of the two names can be used on any given element.

But all they can say in document constraints is
the last sentence: "only one of the two names can
be used on a given element".  It would be up to
the user agent to interpret the specification of
one to be the alias of the other.

This document constraint is a co-occurrence
constraint.  Not many validation languages
support co-occurrence constraints, only RELAX-NG and Schematron.

In RELAX-NG compact syntax I can say:

id-attrs = ( attribute id { xsd:ID } | attribute xml:id { xsd:ID } )

and then on each element "X" say:

element X = id-attrs?, ....

I see from Annex B of your document that RELAX-NG
is being used, so you should be okay.

>I believe that xml:lang and xml:base are similar,

I don't see how.

>and there is a chance that aliasing could help
>resolve some of the problems with xlink.

If so, then it would probably, again, be a
co-occurrence constraint of expressing the
mutual-exclusiveness of multiple attributes.

I hope this helps.

. . . . . . . . . . . Ken

--
UBL/XML/XSLT/XSL-FO training:         Vårø, Denmark 06-09-25/10-06
World-wide corporate, govt. & user group UBL, XSL, & XML training.
G. Ken Holman                 mailto:[hidden email]
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/x/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/x/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


Reply | Threaded
Open this post in threaded view
|

Re: aliasing elements

C. M. Sperberg-McQueen
In reply to this post by Jim Jewett


On 16 Aug 2006, at 12:38 , Jim Jewett wrote:

>
> Is there any way to alias an element or attribute from another  
> namespace?

Alas, not in the current state of the art.

The idea has been kicked around, though, and it has seemed to
some people that it would be convenient.  If it's something you
would like to see in some future version of XML Schema, now would
be a good time to say so.

-C. M. Sperberg-McQueen


Reply | Threaded
Open this post in threaded view
|

Re: aliasing elements

Jim Jewett
In reply to this post by G. Ken Holman

On 8/16/06, G. Ken Holman <[hidden email]> wrote:
>
> At 2006-08-16 14:38 -0400, Jim Jewett wrote:
> >Is there any way to alias an element or attribute from another namespace?
...
> >I believe that xml:lang and xml:base are similar,

> I don't see how.

These two (along with id) are often the only attributes which have a
mandatory external namespace.  When specifying valid attributes, it is
ugly and awkward to say that one has a colon in the middle of its
name.  But not using the external namespace can lead to compatibility
problems.  (This is probably worst with id, because of the role of id,
but it is always awkward.)

-jJ

Reply | Threaded
Open this post in threaded view
|

Re: aliasing elements

Al Gilman
In reply to this post by C. M. Sperberg-McQueen

At 3:00 PM -0600 8/16/06, C. M. Sperberg-McQueen wrote:
>On 16 Aug 2006, at 12:38 , Jim Jewett wrote:
>
>>
>>Is there any way to alias an element or attribute from another namespace?
>
>Alas, not in the current state of the art.

[I speak as a fool.]

1. Machinable metadata in the schema

One, relatively indirect approach that we in the Protocols and
Formats Working Group have kicked around [1] as a possible approach to
documenting a compare-and-contrast with prior art [2] is to
use machinable metadata embedded in the xsd:appinfo in the schema.

Related to this is a debate (the jury still out so far as I know) as to
whether SKOS terms [3] are appropriate to apply to markup-language
concepts such as that represented in syntax by xml:id or xml:base.

But if one wanted to put a vanilla 'id' attribute in their own
namespace, could they, in RDF in xsd:appinfo, assert their intent
that it be processed the same as xml:id and that its values could not
overlap the values of the latter attribute in the appropriate scope?

[1] http://lists.w3.org/Archives/Public/wai-xtech/2005Oct/0010.html

[2] http://www.w3.org/TR/xag#cp4_5

[3] http://www.w3.org/TR/swbp-skos-core-guide/

2. Derivation

As I say, I am a fan of schemas, not an expert.

I thought that data structures are developed in two steps.  First the
structure is defined, and then bound to syntax.

Is this just for structures?  Or is the two-phase creation of typed
syntax global?

Can a new XML dialect import from a foreign schema at the type-definition
layer and bind to new and different syntax?  Does this fail in the case of
xml:id because the compromise struck over xml:id [4] does not depend on
schemata?

[4]  http://www.w3.org/TR/xml-id/

3. Type sharing

Actually, for xml:id I don't see the problem. A dialect can declare
an attribute, whether named 'id' or anything else, to be of _type_ ID
and it is automatically a renames in that syntax of xml:id; so long
as the dialect supports the xml:id Rec at all. Because the uniqueness
rules are for "all values of attributes of type ID" and not "all
values of like-named attributes of type ID."

This, of course, makes "type=ID" a class, not a type, but it's what we need.

So I need another example, or an explanation of why that explanation does
not apply.

Al

PS:  I speak as a fool...



>
>The idea has been kicked around, though, and it has seemed to
>some people that it would be convenient.  If it's something you
>would like to see in some future version of XML Schema, now would
>be a good time to say so.
>
>-C. M. Sperberg-McQueen



Reply | Threaded
Open this post in threaded view
|

Re: aliasing elements

Jim Jewett
In reply to this post by C. M. Sperberg-McQueen

On 8/18/06, Al Gilman <[hidden email]> wrote:
> At 5:34 PM -0400 8/17/06, Jim Jewett wrote:
> >>3. Type sharing

> >>Actually, for xml:id I don't see the problem. ... the uniqueness
> >>rules are for "all values of attributes of type ID" and not "all
> >>values of like-named attributes of type ID."

> >They want to rule out

> ><a id="i1" xml:id="i2">

> That sounds like the behavior I would expect of an attribute-alias.

Yes, but it isn't ruled out today, and there doesn't seem to be any
way to do so.

> What behavior do you want to see?

Today, xml:id ==> unique IDs

I (as well as the HTML2 group) would like a convenient way to enforce
"only on id per element"  (The idattrs workaround is better than
nothing.)  From a strict behavioral standpoint, that might be enough.

>From a semantics standpoint, I would like to be able to say "this
attribute really *is* xml:id; defer to that spec for any semantics".
I would like processors of a compound document to recognize their
identity.  For example, it would be fine if xhtml:id or default
namespace id in an xhtml document would get canonicalized as xml:id
when the xml namespace was closer; I just don't want people to be
required to use namespaces for documents that are entirely within a
single spec.

-jJ