michmech / xonomy

A schema-driven XML editor for the web.
MIT License
91 stars 32 forks source link

XPath in names of element/attribute specs #22

Open michmech opened 7 years ago

michmech commented 7 years ago

Suppose I have an XML document like this:

<data type="name">John Smith</data>
<data type="date-of-birth"><day>12</day><month>10</month><year>1935</year></data>

I want to be able to tell Xonomy that the <data> element contains text if @type="name" and that it contains child elements like <day> etc, if @type="date-of-birth".

You can do these things with Xonomy already by giving the various properties of the <data> element specification as functions rather than literal values. But it's complex and messy. It would be easier (for the docspec author) to be able to create two different element specifications for these two XPath expressions:

data[@type="name"]
data[@type="date-of-birth"]

(Originally suggested by Morgan Cundiff of Library of Congress.)