Re: Can an attribute have an alias name?
Mukul Gandhi <[email protected]>
| Newsgroups | gmane.text.xml.schema.devel |
|---|---|
| Message-ID | <[email protected]> |
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, <[email protected]> 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 -- Regards, Mukul Gandhi