Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 15th, 2010, 11:44 AM
Authorized User
 
Join Date: Nov 2010
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Testing my stylesheets

Hi,

I have many style sheets doing quite a lot of different things. When I modify them I like to have a battery of tests which will tell me that I did not break everything when I make changes.

Recently I migrated to Saxon 9.3 EE, and I notice that when I run my test repeatedly it will give me equivalent XML output but not identical, i.e. I cannot simply character compare the output with a gold master file.

With xalan that was easier since the output was always the same for the same data.

Is there a way to tell Saxon to systematically give the same output when it is feed with the same input?

I tried comparing the xml output with XMLUnit but I find it hard to locate the difference from what XMLUnit is telling me.

Any suggestions how to automize stylesheets testing?

Thanks
 
Old November 15th, 2010, 11:49 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Is the output different with different runs of Saxon or do you simply face the problem that your "master" files were created with Xalan and now don't fit the output of Saxon?
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
 
Old November 15th, 2010, 11:57 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

There are a number of things that can legitimately change in the output - for example, the order of attributes within an element. Fortunately most such things don't tend to change even though it's permitted - so I'd be interested to see exactly what kind of change you are experiencing.

For testing, I think there are two approaches possible. One is to canonicalize the output using an XML canonicalizer - that's what I do in most of my testing. The other possibility is to do testing based on XPath assertions applied to the result, as is done in XSpec and in Selenium. Using XPath assertions is far more flexible, because it allows you to ignore things that you know are likely to vary in the output, such as timestamps.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old November 15th, 2010, 12:16 PM
Authorized User
 
Join Date: Nov 2010
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Martin, yes "the output different with different runs of Saxon".

The difference will be for example that the list of name spaces defined in the xml header might change order. Some times other attributes will swap in for a given element. So very often different runs will give the same identically the same output but one in a while there will be a small difference which does not change the meaning of the xml document but which makes my simple char compare fail.

I will look into the XML Canonicalizer.

Mike, which one are you using?

Thanks for all your replies.
 
Old November 15th, 2010, 02:44 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

>I will look into the XML Canonicalizer. Mike, which one are you using?

I use one written very many years ago by James Clark, customized a little by me so I can specify for example whether to strip whitespace or comments. It doesn't actually use the W3C canonical form rules. There are probably better things available today, but it works for me.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
App_Themes stylesheets Will ASP.NET 4 General Discussion 3 August 20th, 2010 02:07 AM
Accessing variables from parent stylesheets in included stylesheets apollo13 XSLT 2 March 31st, 2010 03:30 AM
Changing StyleSheets [email protected] Javascript How-To 2 May 18th, 2004 03:40 PM
CSS Stylesheets Lucy Dreamweaver (all versions) 4 November 4th, 2003 04:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.