XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Schematron and RNG, RNC


Thought it a bit interesting that when converting

    <s:pattern id="condition.checks">
      <s:title>Whenever condition attribute is used the element should have have an xml:id or cref
        attribute</s:title>
     
      <s:rule context="*[exists(@condition)]">
        <s:assert test="exists(@cref) or exists(@xml:id)">There should be an xml:id or cref
          attribute</s:assert>
      </s:rule>
    </s:pattern>



with trang I get this lovely concoction,,




s:pattern [
  id = "condition.checks"
  "\x{a}" ~
  "      "
  s:title [
    "Whenever condition attribute is used the element should have have an xml:id or cref\x{a}" ~
    "        attribute"
  ]
  "\x{a}" ~
  "      \x{a}" ~
  "      "
  s:rule [
    context = "*[exists(@condition)]"
    "\x{a}" ~
    "        "
    s:assert [
      test = "exists(@cref) or exists(@xml:id)"
      "There should be an xml:id or cref\x{a}" ~
      "          attribute"
    ]
    "\x{a}" ~
    "      "
  ]
  "\x{a}" ~
  "    "
]


I've since formated the rng without as many line breaks below which is a bit better but I gather Trang likes adding escaped newlines \x{A} to the rnc..

this can all be stripped?

  "\x{a}" ~
  "    "

Regex to the rescue? or am I doing something wrong?

thanks



s:pattern [
  id = "condition.checks"
  "\x{a}" ~
  "    "
  s:title [ "Whenever condition attribute is used the element should have have an xml:id or cref attribute" ]
  "\x{a}" ~
  "     "
  s:rule [
    context = "*[exists(@condition)]"
    "\x{a}" ~
    "      "
    s:assert [ test = "exists(@cref) or exists(@xml:id)" "There should be an xml:id or cref attribute" ]
    "\x{a}" ~
    "    "
  ]
  "\x{a}" ~
  "  "
]


On Fri, Feb 3, 2012 at 4:05 PM, John Cowan <cowan@mercury.ccil.org> wrote:
[sch:pattern
 [sch:title "Date rules"]
 [sch:rule context="Contract"
   [sch:assert test="ContractDate < current-date()"
     "ContractDate should be in the past because future contracts are not allowed."]]]

Clunky, but usable.  Trang understands this syntax when converting from
RNG to RNC and vice versa.



--
Alex Muir
Program Organizer - University Technology Student Work Experience Building
University of the Gambia

http://sites.utg.edu.gm/alex/

Come visit Gambia enjoy the sun and culture and help out! Software Engineering Lecturers needed!
Join UTSWEB do local contract work or give a student a contract remotely for slow, cheap and good work http://sites.utg.edu.gm/utsweb/

Some fantastic African/Canadian Fusion  http://bafila.bandcamp.com/



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


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS