Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: Xml Schema substitution groups / key keyref [Thread Next] Re: Xml Schema substitution groups / key keyrefTo: NULL Date: 9/2/2005 7:23:00 PM Hi Priscilla , Many thanks for the reply. It worked a treat. Thanks again Darren "Priscilla Walmsley" <nospam@d...> wrote in message news:TaYRe.3$1u4.1219@n...... > Hi, > > If you want the identifiers to be unique across all reports and targets, > you can add this to your declaration of the Request element: > > <xs:key name="uniqueIDs"> > <xs:selector xpath="*"/> > <xs:field xpath="@identifier"/> > </xs:key> > > If you only want the identifiers to be unique among targets (and not > reports) and you know all the target element names in advance, you could > use: > > <xs:key name="uniqueIDs"> > <xs:selector xpath="demo:DummyTarget|demo:DummyTarget2"/> > <xs:field xpath="@identifier"/> > </xs:key> > > But, if you only want the identifiers to be unique among targets, and > you don't want to hard code the names in there, I think you'd have to > use a different attribute name for target IDs vs. report IDs. > > To enforce the reference, you can use: > > <xs:keyref name="validRefs" refer="uniqueIDs"> > <xs:selector xpath=".//demo:TargetReference"/> > <xs:field xpath="@identifier"/> > </xs:keyref> > > Note that I use a "demo" prefix - You would have to map your target > namespace to a prefix in your schema in order for this to work, because > XPath expressions do not take into account default namespace > declarations. > > Hope that helps, > Priscilla > > ---------------------------------- > Priscilla Walmsley > Author, Definitive XML Schema > http://www.datypic.com > ---------------------------------- > > *** Sent via Developersdex http://www.developersdex.com *** | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
