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</f开发者_JAVA技巧name>
</customer>
<customer record="2">
<fname>david</fname>
</customer>
</customerupdate>
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
You can't generate these values with an XSD processor, that's not its job. But it's very easy to do with XSLT.
精彩评论