Re: Can an attribute have an alias name?

Not allowing both attributes (name and new-name) at the same time cannot be 
done in XML-Schema 1.0. It can be done in Schematron or in XML-Schema 1.1 
(using the schematron construct).
Do you really have a change in a well-established spec/schema? That should 
lead to a new version of the spec/schema. This would mean that the new 
schema has a different namespace than the old one, so that it is always 
immediately clear whether an instance XML file is according the old version 
of the spec or according the new version.

The best solution i.m.o. is to write a little XSLT that transforms old files 
into new ones, copying everything except for the attributes that changed 
name, and replacing the latter ones. If the new version has a different 
namespace, updating it can also be done at the same time.This is much easier 
than doing a mass scripted edit of all files.

Best,

Jozef Aerts
XML4Pharma


----- Original Message ----- 
From: <mlcook@Wabtec.com>
To: <xmlschema-dev@w3.org>
Sent: Thursday, June 30, 2011 3:52 PM
Subject: Can an attribute have an alias name?


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

This email and any attachments are only for use by the intended recipient(s) 
and may contain legally privileged, confidential, proprietary or otherwise 
private information.  Any unauthorized use, reproduction, dissemination, 
distribution or other disclosure of the contents of this e-mail or its 
attachments is strictly prohibited.  If you have received this email in 
error, please notify the sender immediately and delete the original.

Received on Friday, 1 July 2011 06:03:39 UTC