Knowing the End Result

 
xslt for dummies
Chapter 2 - Writing Your First XSLT Stylesheet
XSLT For Dummies
by Richard Wagner
Hungry Minds 2002
  

XSLT transforms XML documents into something new. But before you can write an XSLT stylesheet, you need to have a pretty good idea about what you want that something to look like. So, for this first example, suppose you need to create a new version of the scores.xml document that has three changes from the original:

  • The children of each score element are turned into attributes.

  • The grade element is removed.

  • The year element is renamed releasedate .

Take the first element as an example:

 <score id="1"> <film>A Little Princess</film> <composer>Patrick Doyle</composer> <year>1995</year> <grade>100</grade> </score> 

With these changes applied, the new element looks like this:

 <score id="1" film="A Little Princess" composer="Patrick Doyle" releasedate="1995"/> 

All the preliminaries are now set. You created your source XML file. You know what the target document needs to look like. You are now ready to become a XSL transformer. Yippee!

  
 
 
2000-2002    Feedback


XSLT For Dummies
XSLT for Dummies
ISBN: 0764536516
EAN: 2147483647
Year: 2002
Pages: 148

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net