W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2011

Re: Can an attribute have an alias name?

From: Mukul Gandhi <gandhi.mukul@gmail.com>
Date: Fri, 1 Jul 2011 11:47:13 +0530
Message-ID: <BANLkTikGq43dTguRm6-KOrqQBNgcv7dR5w@mail.gmail.com>
To: mlcook@wabtec.com
Cc: xmlschema-dev@w3.org
It seems that this may be implemented with XML Schema 1.1 assertions
(as follows),

<xs:assert test="count(@name | @new-name) = 1"/>

Additionally to such an assertion, I think we need to make sure that
these two attributes need to be declared optional (i.e don't use
use="required" on both these attributes) at level of xs:attribute.

On Thu, Jun 30, 2011 at 7:22 PM,  <mlcook@wabtec.com> wrote:
> One of our specification documents has changed, and one result is that there has been some renaming of data fields.
> We have lots of XML files that use elements with attributes named according to the previous specification document.
> In order to avoid editing all of those files, I was wondering whether there was a simple schema change that would allow using old and new names for the same attribute.
> An existing element might be:
> <action name="forward" />
> Using the new naming scheme, the element would be
> <action new-name="forward" />
> But I don't want to allow both "name" and "new-name" in the same element.
> The XSL transformation would need to be able to handle both names, also.
> (Using the old names for the new data fields isn't a crisis, but it would be nice to be able to use new names as well.  In the long run we could perform a big scripted edit of all the files.  They're under source control, so we'd just get another file version.)
> Any suggestions?
> Thanks,
> Mike Cook

Mukul Gandhi
Received on Friday, 1 July 2011 06:18:00 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:59 UTC