xsl-list
[Top] [All Lists]

Re: Junit-type Framework for XSLT 2 Functions and Templates?

2005-05-17 15:37:29

DaveP wrote

   On Tue, 2005-05-17 at 06:39 +1000, Dimitre Novatchev wrote:

   > 
   >   Do we have a tool that given a schema generates a sequence of
   > instances, which (in its infinite entirety) covers all instances
   > defined by the schema and is ordered from simple to more complex (e.g.
   > by the length of the produced xml document)?
   > 
   > 
   > I have asked this question at least twice on separate occasions and
   > the answer seems to be negative.


Dimitre, I have good news for you!


   There *should* be.
   msv + http://www.sun.com/software/xml/developers/instancegenerator/

Dave, That  page doesn't claim that instancegenerator generates an
infinite sequence of all instances, does it really do that?

   but I couldn't get it to work.

   Instead, as a poor mans alternative.

   1. From whatever source, use trang to go into rng.
   2. I have a stylesheet which then seeks all unique elements
    (and attributes), and can generate an xml file.
   It doesn't do the 'all instances' (which instance generator is supposed
   to do), but it may provide a start Dimitre.

That sounds like a very finite list to me.

To get the infinite sequence Dimitre asked for, of all schema valid
documents ordered by length, note that any schema valid document is a
finite string of unicode characters, and as the set of finite strings
over a finite alphabet is countable, we can enumerate them in order.
just list the natural numbers 1, 2, 3... in  base 1114112 (hex 10FFFF + 1),
using unicode characters as the digits.

That gives you the countably infinite sequence of finite unicode
strings, then pass each string through a schema validator of your choice
and discard it if it is not a well formed and schema valid instance of
the schema in question. The resulting sequence is the requested result.

I'm sure that Dimitre will be happy with the purity of the algorithm and
not quibble unduely about its computational complexity or the expected
time that it takes to generate any items in the sequence.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--