Re: [xsl] comparing XML document structure

Subject: Re: [xsl] comparing XML document structure
From: "Tony Graham" <tgraham@xxxxxxxxxx>
Date: Thu, 18 Aug 2011 00:44:02 +0100 (IST)
On Wed, August 17, 2011 11:48 pm, Wendell Piez wrote:
> It sounds like you want to infer content models on the fly and then
> validate against them. I can imagine approaches to this, but I doubt
> that I'd trust many algorithms that actually attempted it -- not because
> of XSLT, but because of the problem specifying the problem.
...
> But why not use a schema? There are processors such as Trang that can
> infer schemas from documents.

What Wendell said.

...
> On 8/17/2011 5:57 PM, Graydon wrote:
...
>> The desired goal is to be able to programmatically pull the structure,
>> at least to the extent of parent-child element pairs, from the
>> semantics-defining file, and compare that to each output file in turn.
>>
>> So if the semantics-defining file gives an example section element,
>> which has num, para, and subsection element children, what I want to be
>> able to do is create a sequence of axis relationships and test the
>> section elements of the output for axis relationships that are not
>> members of that sequence.

It would help the rest of us wrap our heads around the problem if you
could provide a sample fragment of the "semantics-defining file" so we can
see what you are dealing with.

You may be able to create the tests you want in Schematron, but it's a bit
hard to tell without having an example to look at.  (If you can generate
Schematron from your definitions, you could directly create XSLT for the
axis tests about as easily, but the advantage could be that there are
tools such as XML IDEs that already understand the Schematron report
format.)

Regards,


Tony Graham                                   tgraham@xxxxxxxxxx
Consultant                                 http://www.mentea.net
Mentea       13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
 --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
    XML, XSL FO and XSLT consulting, training and programming

Current Thread