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

Re: Versioning of Enums


sch code
Fraser Goffin wrote:

> 4. Large lists are still a problem right ?. It is not unusual in the 
> financial services sector for many lists to be > 200 entries, a 
> reasonable number to be > 1000 and a few that are >10,000. Using 
> schematon XSLT would be a bit impractical wouldn't it ?


ISO Schematron and Schematron 1.6 have a <let> expression* which allows 
you to, for example, have an XPath to gather the codes once into a 
variable, then test against that variable.  So you don't need to 
download the external document and traverse the tree each time.  
However, you would have to iterate through the list each time, which is 
still time consuming.  There are various optimization trick possible for 
extreme cases: for example, of the top of my head (Xpaths may be shonky 
here)

 <sh:rule context="thing[@code]">
   <sch:let name="codes" 
value="document('http://www.eg.com/codes')/*/codes"/>
   <sch:assert  test=" $codes/codes/. = @code" >
        the code should be found on the list
  </sch:code>
</sch:rule>

Use 26 rules

 <sh:rule context="thing[starts-with(@code, 'A')]">
   <sch:let name="codes" 
value="document('http://www.eg.com/codes')/*/codes[starts-with(@code,'A')]"/>
   <sch:assert  test=" $codes/codes/. = @code" >
        the code should be found on the list
  </sch:code>
</sch:rule>
 <sh:rule context="thing[starts-with(@code, 'B')]">
   <sch:let name="codes" 
value="document('http://www.eg.com/codes')/*/codes[starts-with(@code,'B')]"/>
   <sch:assert  test=" $codes/codes/. = @code" >
        the code should be found on the list
  </sch:code>
</sch:rule>
...

Brute force, but sometimes effective. (Note that there is no reason why 
an assertion
should not require several rules or assert statements to support it. The 
assertion text
is not a comment on the XPath, but a postive statement of something 
which the XPath
partially or fully checks. )

Or another workaround can be to use URLs: have a little servlet that 
accepts a code
as an argument then returns <true/> or <false/> as the result. Then your 
assertion
test constructs a URL with the code insterted into a URL query.  Again, 
not always
the best way to do things, but certainly a method that is not so 
available to XSD
etc.
    <sch:assert 
test="document(concat('http://www.eg.com/servlet/codes?code=', 
@code))/true">
        the code should be found on the list
    </sch:assert>

Cheers
Rick Jelliffe



* It follows XSLT's let exactly. Trivial to add to an existing 
implementation in one line in the straightforward way.

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.