Subject: Re: [xsl] Junit-type Framework for XSLT 2 Functions and Templates? From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> Date: Wed, 18 May 2005 21:42:09 +1000 |
On 5/18/05, David Carlisle <davidc@xxxxxxxxx> wrote: > > 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. Sorry, I was absolutely stumped by your message and I understood what you're saying only now. I am accustomed to the lazy evaluation style of Haskell, where passing parameters of infinite length is something natural, like: take 5 [1,2 ..] takes the first 5 elements of the infinite list of natural numbers. It is most natural to take a finite number of elements (in our case instances of a particular schema), from an infinite list generated by another function. Cheers, Dimitre Novatchev.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Junit-type Framework for , Michael Kay | Thread | Re: [xsl] Junit-type Framework for , David Carlisle |
Re: [xsl] building path expressions, omprakash . v | Date | Re: [xsl] building path expressions, David Carlisle |
Month |