preload

XSL introduction and references

Posted by Albert Gareev on Nov 30, 2009 | Categories: XML Data


Parent page: Service Functions – XML (QTP, VBScript) 

What is XSL?

The Extensible Stylesheet Language.
An XSL script is a set of transformation instructions used by an engine (often, web browser, but could be any other processing program as well) to produce a new document based on XML input document. The original document remains unchanged.
The output document format can be another XML, HTML, or plane text.

How XSL could be used in test automation?

XML files verification

Manual verification of XML file contents and structure is a very tedious job, and only small-sized files could be  tested that way. Implementation of XML parsing script requires time and does remove the need to manually go over comparison logs. Each XML structure to compare will require creation of a separate script.

Having displayed XML-based data records as a structured and color coded tables on a web-page tester can go through a hundreds of records in just a few minutes.

Example. XML verification example

 

XML log to Web-page report transformation

It’s very convenient to generate and store execution logs in XML format. That could be Test Execution Logs, File Comparison Logs, Data Processing Logs, anything. However, XML tree view is not screen or paper friendly. Producing logs directly in HTML format creates extra maintenance issues.

Using XSL scripts allows transforming XML log files into easily viewable, content-rich, navigation-enhanced, and printer-friendly web-pages. Same XML log could be displayed in a variety of forms (detailed, summary, fail reports, etc)  by quickly switching  to different XSL templates.

Example. Text File Compare Report example

 

Documentation and references.

XSLT Questions and Answers

XSL Transformations 

Converting XML to HTML using XSL

Reference Cards


  • One response to "XSL introduction and references"

  • Anonymous
    30th April 2010 at 19:21

    Thanks for the great compilation of examples!

  • Leave a Reply

    * Required
    ** Your Email is never shared

Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported
This work by Albert Gareev is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported.