tags:

views:

665

answers:

7

I want to learn the programming skills in XSLT to convert from XML to XML .. step by step ..

I am finding it hard to program with XSLT .. I have tried w3schools.com, tizag.com and books like XSLT from novice to professional(O'Reilly publications) etc,
all these teach to convert XML to HTML page ..but I need some tutorial or guide which can teach me the basic (and efficient) tricks like 1)converting elements to attributes and vice versa.. 2)moving an element and its child elements under another.. 3)Creating a new Parent node.. 4)Testing the presence of an element.. 5)Editing the data of an element .. and many more ...... in other words to convert from XML to XML...

The area am working on is XSL transformation where I need to convert input XML document to the new output XML using hundreds of conditions as mentioned above ..
well. I have tried and have been successful in achieving the above requirements but I want to learn the efficient way for doing those things ..

so please please .. suggest me some good tutorials or books ... thanx in advance

+4  A: 

To learn more about converting XML documents, I found the following link very useful:

http://www.xmlplease.com/xsltidentity

It explains how to write an "Identity Template": an XSLT that creates an exact copy of the input file. It than shows you how to add exceptions, for example how to rename a certain element. I found this method very useful to write XSLTs for upgrading XML configuration files in our application.

Martijn Boeker
+1  A: 

You want Michael Kay's books on XSLT. If you're using XSLT 2, make sure you get one of the "newer" books with "XSLT 2.0" in the title. He discusses XSLT as a programming language, going so far as to solve the 8 queens problem in XSLT. Highly recommended.

A good pattern in XSLT to start with is the identity transform. Many times your XSLT program boils down to copying the input XML document with small changes here and there. You set up an identity transform that recursively copies the input document by default and provide xsl:template overrides for the parts of the document you want to change.

Harold L
+9  A: 

XSLT is like poker, easy to get into, but difficult to master.

You need to focus your effort, as you say you want to focus on XML to XML transformation, then do so. There are certainly a lot of material available online. But there are also good books written on the subject.

So my advice is (before i go into tutorials online) to try and find a good book, read it. And if you're like me, learning by doing is a great way to really develop skills and knowledge. If you don't know what book to read, start with one by Michael Kay, they are usually of very high quality.

For best practices a good starting point is the identity transform.

Be sure to learn a little about namespaces, xml schema and check out xquery as well.

You also need a high quality XSLT Processor my recommendation is Saxon by Michael Kay, but any one will do for basic transformation.

Tutorials

Best practices

Oh, by the way, XHTML is also XML, there is no difference in my eyes.

Peter Lindqvist
+1  A: 

A very useful resource to me is Dave Pawson's XSL FAQs (also handling XSL-FO). It's basically a digest of the XSLT mailing list, but you get a lot of nicely categorized and edited answers for a lot of topics.

Edit: Peter had it already in his links collection. I'll keep this answer to emphasize the page.

Boldewyn
+3  A: 

Understanding the identity transformation and everything else in XSLT depends on a good grasp of the core processing model. If you want a concise but comprehensive description of XSLT's processing model (for 1.0 but equally applicable to 2.0), check out this exposition I wrote: "How XSLT Works".

Evan Lenz
A: 
infant programmer
+3  A: 

T U T O R I A L S:

  Some tutorials by Norman Walsh:

  1. On XSLT 1.0
  2. On XSLT 2.0/XPath 2.0

  Link to More tutorials


B O O K S

The classic books of Michael Kay on XSLT 1.0:

      XSLT: Programmer's Reference (Programmer to Programmer)

alt text

and on XSLT 2.0 / XPath 2.0

      XSLT 2.0 Programmer's Reference (Programmer to Programmer)

alt text

and

      XSLT 2.0 and XPath 2.0 Programmer's Reference (Programmer to Programmer) :

alt text



The books by Jeni Tennison:

      Beginning XSLT

alt text

      Beginning XSLT 2.0: From Novice to Professional

alt text

      XSLT and XPath On The Edge, Unlimited Edition

alt text



And Sal Mangano's book:

      XSLT Cookbook, Second Edition

alt text


Blogs:

  1. Michael Kay
  2. David Carlisle
  3. Jeni Tennison
  4. Dimitre Novatchev

S I T E S

  1. xsl-list archives
  2. Dave Pawson's XSLT-FAQ
  3. FXSL -- the Functional Programming Library for XSLT

People to follow on twitter

http://tinyurl.com/yegkobv

Dimitre Novatchev
yup.. that's helpful ..
infant programmer