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 3rd, 2006, 06:56 PM
Authorized User
 
Join Date: Nov 2006
Posts: 28
Thanks: 0
Thanked 1 Time in 1 Post
Default Learning path

Hi

Which one should I read about first: XPath or XSLT? Also, is there a better alternative to XSLT for transforming XML based documents into other XML based documents? Does the complexity of the initial XML document make it easier to use XSLT rather then other methods? The documentation I read this far regarding XSLT has only simple examples. At first glance, I find it to be a little hard but maybe I need a different approach.

Michael
 
Old November 3rd, 2006, 08:02 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You can't use XSLT without using XPath. In principle you can use XPath without using XSLT, but if you're doing transformations, you really need to learn both.

The only real alternative, apart from low-level coding in Java or C#, is to use XQuery. Some people find XQuery easier to learn, especially if they are using data-oriented XML and if they come from a SQL background. That's largely because it's a smaller language - it doesn't have any equivalent to XSLT's template rules, for example. In general, XQuery probably works better for simple tasks on simple documents; in my view XSLT works better for complex tasks on complex documents.

As for documentation, you're on a Wrox site and Wrox do some good books. My own book is rather heavyweight: it goes into all the obscure corners of the language and takes care to explain the underlying concepts and theory. If you're complaining that the examples in beginners' books are too simple, then it might be the one that's right for you.

Do remember that the more powerful a technology is, the more daunting it will feel when you first encounter it.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old November 3rd, 2006, 10:07 PM
Authorized User
 
Join Date: Nov 2006
Posts: 28
Thanks: 0
Thanked 1 Time in 1 Post
Default

Well I need simple task for complex documents, which I guess I can't have; I was also thinking of going with a Java-based parser directly, but XSLT seems to be specifically built for transformation like the one mentioned in my first post.
It's always hard to start something new, and XSLT like you also mentioned, is a complex technology, so it will not be easy to manage.

Does it matter which parser I'm using, since the main part will be in the xsl file? I know about Saxon and Sun's JAXP which comes with the jdk. The main difference I see could maybe be in the time it takes to parse the files (both xml and xsl) and generate the new one. And they are both free (Saxon-B and JAXP).

Thank you also for the advice regarding the documentation!

Mihai
 
Old November 4th, 2006, 04:40 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Unless you have other constraints I would go with the Saxon-B one, the latest version supports XSLT 2.0 so you will be well-placed should you need more complex transformations in the future. The slight downside is that version 1.0 stylesheets run on a 2.0 processor can sometimes behave slightly differently from when run on a version 1.0 processor. I doubt that would affect you though especially if you are writing your transformations from scratch in which case they can be version 2.0 anyway.

The big thing to remember with XPath/XSLT is to learn the basics, it will save you hours later. The amount of time lost by people who "don't have time to learn" but "just want to get this working" is staggering, a few hours of study to start with will reap rewards later.

--

Joe (Microsoft MVP - XML)
 
Old November 4th, 2006, 04:44 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Before choosing an XSLT processor (please don't call it a parser!) you need to decide whether you want to use XSLT 1.0 or XSLT 2.0. 1.0 is a smaller language and is more widely supported, but there are many tasks (notably grouping, character string manipulation, and date/time handling) that are much easier to perform using 2.0. If you go for 2.0 your only real choice today is Saxon. With 1.0, in the Java world, your most likely choice is between the Xalan processor that's built in to the JDK, or Saxon. They are fairly interchangeable in that both support the JAXP interface, so you can keep your options open.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old November 4th, 2006, 11:23 AM
Authorized User
 
Join Date: Nov 2006
Posts: 28
Thanks: 0
Thanked 1 Time in 1 Post
Default

Thank you both for the replies. It seems only natural to always go with the newest version of a technology (in most of the cases), so I will start learning XSLT 2.0 and use Saxon-B, which supports both XPath 2.0 and XSLT 2.0.

Many thanks again for all your advices.

Michael





Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help with path for loading Pics (app.path) Tabbasum Beginning VB 6 2 November 15th, 2007 04:57 AM
using app.path in database path and filename kd8con VB Databases Basics 2 October 25th, 2006 11:45 AM
Req. suggestions for learning path ddawson59 ASP.NET 2.0 Basics 4 September 11th, 2006 04:17 PM
Convert logical path to absolute path zoostar J2EE 1 April 15th, 2005 10:36 AM
Wrox Books Learning Path... rkconsulting Wrox Book Feedback 1 October 23rd, 2003 08:54 AM





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