msulyaev / xmlskeletondiff

Test if two xml files are structurally equivalent.
1 stars 0 forks source link

FYI Here is your program in xslq format. This is not an issue. :-) #1

Open weetmuts opened 3 months ago

weetmuts commented 3 months ago

Thanks for your interesting xsl tool!

I added --stringparam=key=value to xmq to be able to run your skeleton diff tool.

You can see your xsl here as xslq: https://libxmq.org/resources/xmlskeletondiff.xslq.html

and you can download it from: https://libxmq.org/resources/xmlskeletondiff.xslq

xmq ignore.xml transform --stringparam=debug.strings=false \ --stringparam=file1=art1.xml \ --stringparam=file2=art2.xml \ xmlskeletondiff.xslq

The default output is to-xmq, which will print 'DIFF' You can also use: to-xml or to-text or to-json

You can also run your original program using xmlskeletondiff.xsl (instead of xmlskeletondiff.xslq)

With no debug output the result is the same. If you enable debug.strings=true You will see that the debug info is missing indentation.

 '''{ns:'http://docbook.org/ns/docbook',n:'article',@*:[@{ns:'',n:'version', v:='5.0'}],*:[{n:'info',*:[{n:'title',}{n:'author',*:[{n:'orgname',}{n:'address',*:[{n:'city',}{n:'street',}{n:'postcode',}{n:'country',}]}{n:'email',}]}]}{n:'sect1',*:[{n:'title',@*:[@{ns:'',n:'role', v:='a'}],}{n:'subtitle',}{n:'para',@*:[@{ns:'http://www.w3.org/1999/xlink',n:'xlink:href', v:='hello'}],}]}]}{ns:'http://docbook.org/ns/docbook',n:'article',@*:[@{ns:'',n:'version', v:='5.0'}],*:[{n:'info',*:[{n:'title',}{n:'author',*:[{n:'orgname',}{n:'address',*:[{n:'city',}{n:'street',}{n:'postcode',}{n:'country',}]}{n:'email',}]}]}{n:'sect1',*:[{n:'title',@*:[@{ns:'',n:'role', v:='b'}],}{n:'subtitle',}{n:'para',@*:[@{ns:'http://www.w3.org/1999/xlink',n:'xlink:href', v:='hello'}],}]}]}DIFF'''

Which is because I converted the xsl to xslq I did not use --trim=none which meant that some implicit indentation was lost.

But does the indentation somehow change due to the content in the diffed files? Or is the indentation just a sideeffect of the original xsl file indentation. I would think it is a sideeffect...but perhaps I am wrong.

Thanks!

msulyaev commented 3 months ago

Wow, thanks, Fredrik! I completely forgot I had that tiny tool out on Github! Almost a decade ago, I sure had some problem at hand back then, so I wrote this stylesheet, but what the problem was is long gone.

Yes, params are essential for any software that does XSL transformations. Great that you added them in 2.9.0!