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

Re: [Summary] Portable Data Components

  • From: Stephen D Green <stephengreenubl@gmail.com>
  • To: Dave Pawson <davep@dpawson.co.uk>
  • Date: Wed, 13 Apr 2011 22:07:36 +0100

Re:  [Summary] Portable Data Components
I guess the Schematron equivalent has the advantage of simplicity and
doesn't lose out on portability if any prerequisites are merely turned
into qualifications on the context:

<schema xmlns="http://purl.oclc.org/dsdl/schematron">
    <pattern>
        <rule context="/InvoiceCalculationModelReport/IN1[1]">
            <assert test="InvoiceCount[1]='1'">IN1 Failed</assert>
        </rule>
    </pattern>
    <pattern>
        <rule context="/InvoiceCalculationModelReport/INTOT1[1][DistinctCurrencyCount[1]='1']">
            <assert
test="LegalMonetaryTotalLineExtensionAmount[1]=SumOfLineExtensionAmounts[1]">INTOT1
Failed</assert>
        </rule>
    </pattern>
</schema>


Anything I can do better? I'd like to add reports too so that I get
some output even when a test cases is passed, not just when it fails
but that seems have an unwanted side effect of making the pass look
like a validation error.

<schema xmlns="http://purl.oclc.org/dsdl/schematron">
    <pattern>
        <rule context="/InvoiceCalculationModelReport/IN1[1]">
            <assert test="InvoiceCount[1]='1'">IN1 Failed</assert>
            <report test="InvoiceCount[1]='1'">IN1 Passed</report>
        </rule>
    </pattern>
    <pattern>
        <rule context="/InvoiceCalculationModelReport/INTOT1[1][DistinctCurrencyCount[1]='1']">
            <assert
test="LegalMonetaryTotalLineExtensionAmount[1]=SumOfLineExtensionAmounts[1]">INTOT1
Failed</assert>
            <report
test="LegalMonetaryTotalLineExtensionAmount[1]=SumOfLineExtensionAmounts[1]">INTOT1
Passed</report>
        </rule>
    </pattern>
</schema>

I've only got satisfactory results if I use an intermediate report
file aganst which to write the rules though, otherwise the XPaths are
too complex (especially if I include prerequisites as qualifications
on the context XPaths).

Cheers

Steve


On 12/04/2011, Dave Pawson <davep@dpawson.co.uk> wrote:
> On Tue, 12 Apr 2011 14:03:17 +0100
> Stephen D Green <stephengreenubl@gmail.com> wrote:
>
>> It occurs to me though that this is an example of a situation
>> where each component needs to be kept self-contained so
>> that it can be portable and this might determine how test cases
>> are written and even, by follow-through, how TAs are written
>> and maybe even how specs might better be written. I think,
>> from what I've heard from others, there would be a few challenges
>> to overcome if you were to use Schematron though (e.g. how
>> to apply several tests to the same context and prerequisites),
>> just as perhaps with XML Schema 1.1, especially given a lot of TAs.
>> ----
>> Stephen D Green
>
> I think you'll find Schematron up to your challenges Stephen
>
>
>
> --
>
> regards
>
> --
> Dave Pawson
> XSLT XSL-FO FAQ.
> http://www.dpawson.co.uk
>


-- 
----
Stephen D Green


[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.