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 February 17th, 2012, 10:55 AM
Authorized User
 
Join Date: Jul 2010
Posts: 74
Thanks: 23
Thanked 0 Times in 0 Posts
Question How to upgrade XSLT 1.0 to 2.0

I have searched online for a while, but I cannot find any useful information about the upgrade XSLT 1.0 to 2.0.

Is anyone know how to do that? Please give me detailed steps and information.

Thank you in advance.
 
Old February 17th, 2012, 11:21 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Typically if you move from XSLT 1.0 to 2.0 you will be moving to a different XSLT processor, and that will usually have more impact than any difference in the standards - for example differences in APIs and vendor extensions.

The other thing that varies immensely is regression testing. If you have a large suite of regression tests, then put them through a 2.0 processor and see what happens. If you don't have a large set of regression tests, then you need to think about how else to manage the risks - which are small, but not ignorable, as with any software configuration change.

XSLT 2.0 has a "backwards compatibility mode" enabled by leaving the version number set to 1.0. If you have a good test suite, change this to 2.0 and see whether it causes any problems (sometimes it will reveal errors in your stylesheets that have gone undetected for years). If you don't have a good test suite, a more cautious approach is to leave the version attribute set to 1.0.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
The Following User Says Thank You to mhkay For This Useful Post:
JohnKiller (February 17th, 2012)
 
Old February 17th, 2012, 11:39 AM
Authorized User
 
Join Date: Jul 2010
Posts: 74
Thanks: 23
Thanked 0 Times in 0 Posts
Default

Thank you, Michael. Yes, the moving will impact a lot. But I meet the problem which I can not figure out in Version 1.0, which in version 2.0 can easily be solved(see the post Can xsl check specific type, I need to check the data type, for example 6th, 293th, 2nd, I only need to check this contains number+th|nd, and just get the number part. If it is"Wath", returns "Wath".). I have change the stylesheet attribute to version 2.0:
Code:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" exclude-result-prefixes="xs" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
, but it does not work as 2.0.

Can we run 1.0 and 2.0 together for different files? Like for 1.xsl we run version 1.0, but for 2.xsl we run version 2.0.

Thank you so much.



Quote:
Originally Posted by mhkay View Post
Typically if you move from XSLT 1.0 to 2.0 you will be moving to a different XSLT processor, and that will usually have more impact than any difference in the standards - for example differences in APIs and vendor extensions.

The other thing that varies immensely is regression testing. If you have a large suite of regression tests, then put them through a 2.0 processor and see what happens. If you don't have a large set of regression tests, then you need to think about how else to manage the risks - which are small, but not ignorable, as with any software configuration change.

XSLT 2.0 has a "backwards compatibility mode" enabled by leaving the version number set to 1.0. If you have a good test suite, change this to 2.0 and see whether it causes any problems (sometimes it will reveal errors in your stylesheets that have gone undetected for years). If you don't have a good test suite, a more cautious approach is to leave the version attribute set to 1.0.
 
Old February 17th, 2012, 11:52 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Upgrading your version of XSLT involves more than just changing the number in the XSLT file - its more like if you wanted to upgrade from Word 2007 to Word 2010, you can't just change something in a word document to upgrade - you actually need to install the new version of word.

Much like versions of word, xslt processors are 'backward compatible' as Michael mentioned, so you can use a XSLT 2.0 processor to process 1.0 XSLT files in most instances.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
The Following User Says Thank You to samjudson For This Useful Post:
JohnKiller (February 17th, 2012)
 
Old February 17th, 2012, 12:18 PM
Authorized User
 
Join Date: Jul 2010
Posts: 74
Thanks: 23
Thanked 0 Times in 0 Posts
Default

Thank you both so much!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Upgrade from ASP 1.1 to 2.0 Gaurav Sinha ASP.NET 2.0 Basics 0 February 18th, 2007 11:52 PM
When to Upgrade to Oracle! timoma Oracle 2 June 20th, 2005 08:42 AM
Upgrade Question JAtkinson VS.NET 2002/2003 3 February 21st, 2004 04:09 AM
PHP Upgrade briggsa Beginning PHP 1 July 21st, 2003 02:17 PM





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