Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Xml Schema substitution groups / key keyref

From: Priscilla Walmsley <nospam@-------.--->
To: NULL
Date: 9/2/2005 1:10:00 PM
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 ***


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent