[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] [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
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]