xsl-list
[Top] [All Lists]

Re: [xsl] XML schema: require a descendant?

2017-07-08 12:40:20
Hey Chuck,

Another route to XPath-based validation -- wherein you could implement
a rule for your entry that at least one 'sense' child has
some-child-or-other -- would be embedding Schematron in your schema --
or maintaining an extra-schema constraint layer (in the form of a
Schematron) -- and then doing it there.

You can embed Schematron into RNG or XSD given support from tools
(such as oXygen). But you might start with an external Schematron - or
you could go full-bore TEI and do it in an ODD ...

Cheers, Wendell


On Sun, Jul 2, 2017 at 5:05 AM, Wolfgang Laun 
wolfgang(_dot_)laun(_at_)gmail(_dot_)com
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
XML Schema 1.1 has XPath evaluation and validation. Your constraint can be
easily expressed as the existence of at least one <sense> with at least one
child element for an <entry>.

-W

On 2 July 2017 at 10:01, Charles Muller 
acmuller(_at_)l(_dot_)u-tokyo(_dot_)ac(_dot_)jp
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

I guess this might be a bit off-topic for an XSLT list, but in any case
it's related to XPath.

In my data (simplified here):

<entry>
  <sense>
  <sense>
  <sense>
</entry>

I want at least *one* of the <sense> nodes to contain <term>, <persName>,
or <title>. But it only needs to be in one of them, thus <entry> needs at
least one descendant from the above three tags.

Is there a way of writing this into a DTD or schema?

Chuck


---------------------------
A. Charles Muller

Graduate School of Humanities and Sociology
Faculty of Letters
University of Tokyo
7-3-1 Hongō, Bunkyō-ku
Tokyo 113-8654, Japan

Office Phone: 03-5841-3735

Web Site: Resources for East Asian Language and Thought
http://www.acmuller.net

Twitter: @H_Buddhism


XSL-List info and archive
EasyUnsubscribe (by email)



-- 
Wendell Piez | http://www.wendellpiez.com
XML | XSLT | electronic publishing
Eat Your Vegetables
_____oo_________o_o___ooooo____ooooooo_^
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>