开发者

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

开发者 https://www.devze.com 2023-02-17 02:01 出处:网络
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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消