OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Versioning of Enums

[ Lists Home | Date Index | Thread Index ]

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.




 

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

Copyright 2001 XML.org. This site is hosted by OASIS