[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: RELAX question re: required value

  • From: George Cristian Bina <george@oxygenxml.com>
  • To: Michael Sokolov <msokolov@safaribooksonline.com>, John Cowan <johnwcowan@g...>
  • Date: Thu, 23 Jan 2014 18:10:51 +0200

Re:  RELAX question re: required value
Hi Mike,

Embedded Schematron works a lot easier if you use Relax NG with the XML syntax.

Best Regards,
George
--
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

On 1/23/14, 5:27 PM, Michael Sokolov wrote:
I found it a little tricky hunting down the proper syntax for this, so
for posterity here is an example of a embedding a schematron assertion
in Relax NG Compact:

         [sch:pattern
             [sch:rule [context="meta"
                 sch:assert [ test="count(collection[.='all']) = 1"
                     "all collection must be present"]]]]

         element collection {
             text
         }+

Thanks, John, for the pointer - this is exactly what I needed.

-Mike

OK so for posterity, in case any
On 01/22/2014 02:14 PM, Michael Sokolov wrote:
I didn't know about the embedding of Schematron rules; sounds very
useful: thanks!

-Mike

On 01/22/2014 01:11 PM, John Cowan wrote:

On Wed, Jan 22, 2014 at 11:30 AM, Michael Sokolov
<msokolov@safaribooksonline.com
<mailto:msokolov@safaribooksonline.com>> wrote:

    I have a schema that allows a bunch of different elements to be
    interleaved in any order; one of them is <collection>;  I want to
    require that a collection with value "all" be present, as well as
    allowing any number of other collections, in any order, using
    RELAX -- is that possible?

No, it isn't.  It would have to be element collection {"all"} &
element collection {text}, and it is forbidden to have the same
element name on both sides of &.  This is one of the few arbitrary
restrictions in RNG.  Even that formulation, if it were legal, would
allow more than one "all" collection, since there is no way to say
"everything but 'all'" in RNG.

However, this is a perfect application for an embedded Schematron
rule asserting that count(collection[text() = "all"] = 1.  Jing
supports embedded Schematron 1.5 rules quite nicely.

--
GMail doesn't have rotating .sigs, but you can see mine at
http://www.ccil.org/~cowan/signatures
<http://www.ccil.org/%7Ecowan/signatures>




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.