Home > SOA Tips > XML Developer > Migrating to XSLT 2.0
SOA Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

XML DEVELOPER

Migrating to XSLT 2.0


Ed Tittel
05.22.2007
Rating: -3.50- (out of 5)


Enterprise IT tips and expert advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


Those of you who follow my tips know I mentioned that a new XSLT 2.0 recommendation was approved by the W3C in January, more than seven years after version 1.0 made the scene. In fact, it may have been that mention that prompted questions about any differences there might be between extended versions of XSLT (usually based on the 1.0 recommendation) and the new and presumably improved XSLT 2.0. The baldest version of the problem might be stated as "Should I stick with my hand-crafted extensions or drop them in favor of what XSLT 2.0 provides?"

The short answer to that question goes something like this: "That depends: XSLT 1.0 and 2.0 are both inherently extensible, so many of the extensions crafted for 1.0 should also work for 2.0." But as is usual when the rules for any game get changed, there are a few potential gotchas lurking in the weeds. Programmed XSLT 1.0 extensions are subject to the provisos in Section J at the end of the 2.0 Recommendation, which talk about incompatible changes from the 1.0 to 2.0 implementations and start to make sense to readers who've created XSLT 1.0 extensions in terms of what will and won't migrate from 1.0 to 2.0 without some effort and rework on their part (and perhaps some judicious tossing of new functionality that's part of 2.0 that some developers will have crafted in some form or fashion for themselves).

From a "migrating extensions from 1.0 to 2.0" perspective, if the extensions in question replicate or resonate with new functionality in 2.0, it's probably best to drop older, home-made code or capabilities in favor of newer, standard code or capabilities that fall under the recommendation's coverage. Though this may be painful, it will require less maintenance work going forward, in that you can count on the team that keeps up XSLT 2.0 to deal with future changes to standard features and functions rather than having to keep with an entire code base and markup handling components of your own crafting. Some of these changes are mostly organizational and terminological (including items like keys, xsl:number, the format-number function, and xsl:import handling). Support for the XDM data model has also affected how looping and sorting constructs (xsl:for-each, xsl:value-of, and xsl:sort) are handled, and include a new xsl:sequence instruction as well.

The biggest change is that instructions no longer write their outputs to a result tree, rather, they now return sequences of values. Here again, this may be viewed by some as restating existing functionality in new terms, but this approach lets XSLT stylesheets now handle arbitrary sequences of text and data, even those with parentless elements or attribute nodes. Likewise, the concepts of current node and current node list used when navigating a tree are now supplanted with XPath context items, context positions and context sizes. Integration of XML Schema into XPath 2.0 and its widespread use with XSLT 2.0 also means stronger data typing is available, but also that backward compatibility with older typing mechanisms is maintained. Variable and parameter types may now be specified explicitly, while schema validation may be applied to result sequences and for attributed and elements in temporary sequences as well. Finally, error handling has been cleaned up and rules regarding how errors and exceptions are signaled have been tightened up and made more explicit.

Only those who have XSLT 1.0-based applications who have built extensions to the underlying markup language can really decide if they should keep going with what they've got, or re-craft that code base in light of what XSLT 2.0 brings to the table. Because much of the new stuff really is clearer and offers broader functionality, I have to believe that in many such analyses, developers will decide to migrate and trade in their proprietary extensions for new or similar capabilities that come standard in XSLT 2.0.

About the author

Ed Tittel is a full-time writer and trainer whose interests include XML and development topics, along with IT Certification and information security topics. Among his many XML projects are XML For Dummies, 4th edition, (Wylie, 2005) and the Shaum's Easy Outline of XML (McGraw-Hill, 2004). E-mail Ed at etittel@techtarget.com with comments, questions or suggested topics or tools for review.


Rate this Tip
To rate tips, you must be a member of SearchSOA.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
XML Developer
Use the soapUI software tool to tame WSDL
WSDL 2.0, new messaging for Web services
Using RELAX NG For data integration
Efficient XML Interchange tackles data verbosity
XML to DDL imports, synchronizes database schemata
The basics of MathML 3.0
What's up with XML 2.0?
Say hello to XPath 2.0
Podcasting software covers many bases
The XML behind podcasting

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



SOA Trends and Strategy - SOA Education, SOA Development, SOA Implementations
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2001 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts