[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: xml-dev@lists.xml.org
  • Date: Thu, 14 Apr 2011 09:14:07 +0100

Re:  [Summary] Portable Data Components
I think in reality the portability of the Schematron is hindered by
the namespaces (ironically). The namespaces in the example are
not an issue because there are none declared in my 'scratchpad'.
If there were namespaces then we have two alternatives, at least
one of which hinders portability. (And without the 'scratchpad'
intermediary XML, the Schematron schema would have to handle
multiple namespaces when dealing with UBL invoices, for example,
and you'd still be looking for scalable portability/modularity too.)

Option 1: make the XPaths handle the namespaces whatever the
prefix(es) used. I forget how to do this succinctly with XPath 2. If
you stick to (or are stuck with) XPath 1 you can make the expressions
independant of the prefix(es) using something like this I think:
*[local-name()='MyElement'][namespace-uri()='my.namespace']

Option 2: use the 'sch:schema/sch:ns' element in Schematron

Option 1 gets messy and might overstretch the processors
Option 2 seems to me to limit the portability of any 'sch:pattern'
in the Schematron schema because the XPaths are then tightly
bound to the schema and its namespace declarations

I reckon you either need a better way to make the expressions
independant of the namespace/prefix (which itself hides reduced
portability behind that removed prefix since foreign namespaces
will now not be distinguished, I think) or Schematron might perhaps
support more portable patterns by allowing the sch:ns element to
be a child of the sch:pattern. The latter might be a pain to
implement but I think would improve Schematron.

Cheers

Steve

----
Stephen D Green



On 13 April 2011 22:07, Stephen D Green <stephengreenubl@gmail.com> wrote:
> 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>
>


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