Sergei Ledvanov
Sergei Ledvanov

Reputation: 2251

XML Schema: Element with attributes containing values from other attributes

Not sure this is possible with XSD, but still the question is here.

So I have the following code in my xml:

<formats>
    <format name="TableText">
        <item name="halign">left</item>

    </format>
</formats>


<styles>
    <style name="Style">
        <item name="format">TableText</item>
    </style>
</styles>

What I want to achieve is that when the user starts typing content of a format (<item name="format">TableText</item>), he would only be able to enter what he had in a name attribute of a format tag (<format name="TableText">)

Upvotes: 0

Views: 52

Answers (1)

Michael Kay
Michael Kay

Reputation: 163322

It's possible to define a constraint (using key/keyref) that the value of style/item must be a value that's present in format/item, but whether any XML editing tool is able to use such a constraint to drive syntax-directed editing is another question.

Upvotes: 1

Related Questions