Albert T. Wong
Albert T. Wong

Reputation: 1663

XSD How to generate sequence/record number in a unbounded field?

I have an XSD with a field called "customer" that is minOccurs=0 and maxOccurs=unbounded. Is there a way to attach a sequence number to that customer entry automatically?

Ideally the generated XML would look like:

<customerupdate>
<customer record="1">
<fname>albert</fname>
</customer>
<customer record="2">
<fname>david</fname>
</customer>
</customerupdate>

Upvotes: 0

Views: 590

Answers (2)

Michael Kay
Michael Kay

Reputation: 163635

You can't generate these values with an XSD processor, that's not its job. But it's very easy to do with XSLT.

Upvotes: 0

fdaines
fdaines

Reputation: 1246

you cannot do what you want.

You can only define a default or fixed value for attributes, but only static values can be assigned to default/fixed

Examples of default/fixed

W3C Reference

Upvotes: 0

Related Questions