Presentation is loading. Please wait.

Presentation is loading. Please wait.

Transforming XML Part II XML Document Transformation with XSLT John Arnett, MSc Standards Modeller Information and Statistics Division NHSScotland Tel:

Similar presentations


Presentation on theme: "Transforming XML Part II XML Document Transformation with XSLT John Arnett, MSc Standards Modeller Information and Statistics Division NHSScotland Tel:"— Presentation transcript:

1 Transforming XML Part II XML Document Transformation with XSLT John Arnett, MSc Standards Modeller Information and Statistics Division NHSScotland Tel: 0131 551 8073 (x2073) mailto:John.Arnett@isd.csa.scot.nhs.uk http://isdscotland.org/xml

2 Contents XML Document Processing XSL Stylesheets XSLT –Template Rules –Processing Instructions Summary Find Out More

3 XML Document Processing Transformation and formatting –XPath used to locate nodes for input –XSLT used to transform input and generate result tree –XSL-FO used to format output document

4 XSL Stylesheets The Stylesheet element

5 XSL Stylesheets Template Rules

6 XSL Stylesheets Processing Instructions

7 XSL Stylesheets read template find source nodes evaluate processing instructions more templates? yes no Adapted from XSLT Basics slide presentation by Paul Spencer, alphaXML Source Tree Style sheet Result Tree

8 XSLT: Template Rules Template Rule –XPath pattern specifies nodes to match –Output template contains XSLT processing instructions ie. for processing input and creating new element and attribute nodes

9 XSLT: Template Rules Template rule for creating PatientId element from Appointment

10 XSLT: Template Rules PatientId output from template rule ABC-123-456 John Smith ABC-123-456 John Smith ABC-123-456 John Smith

11 XSLT: Template Rules Appointment List + +

12 XSLT: Template Rules Applying Template Rules –Creating a list of PatientId ’s

13 XSLT: Template Rules PatientId ’s list output - ABC-123-456 John Smith + … + - ABC-123-456 John Smith + … +

14 XSLT: Processing Instructions XSLT - rich syntax that enables –Copying –Conditional processing... –Iteration and sorting... –Application of XPath functions... –Creation of new nodes

15 XSLT: Processing Instructions XSLT Elements –xsl:stylesheet –xsl:output –xsl:template –xsl:apply- templates –xsl:value-of –xsl:text –xsl:if –xsl:choose –xsl:when –xsl:otherwise –xsl:foreach

16 XSLT: Processing Instructions Copying and conditional processing –Creating a list of “PHYSIO” appointments

17 XSLT: Processing Instructions “PHYSIO” appointments list output - + Mark Boydd + + - + Mark Boydd + +

18 XSLT: Processing Instructions Iteration and sorting –Creating an appointments summary table......

19 XSLT: Processing Instructions Appointments summary table output

20 XSLT: Processing Instructions Creating new nodes –XSLT instructions value –XSLT output

21 In Summary… XSL stylesheets contain one or more XSLT template rules Template rules specify nodes to match and contain XSLT processing instructions XSLT has a rich syntax for transforming documents into XML and non-XML outputs

22 Find Out More W3C XSL Transformations (XSLT) v1.0 Specification –www.w3.org/TR/xsltwww.w3.org/TR/xslt Getting started with XSLT and XPath by Ken Holman (Parts 1, 2 & 3) –www.xml.com/pub/a/2000/08/holma n/s2_1.htmlwww.xml.com/pub/a/2000/08/holma n/s2_1.html ZVON.org - XSLT Tutorial –www.zvon.org/xxl/XSLTutorial/www.zvon.org/xxl/XSLTutorial/

23 Find Out More Robert Ducharme’s Transforming XML column –www.xml.com/pub/q/transformingxmlwww.xml.com/pub/q/transformingxml TopXML XSLT Stylesheets –www.topxml.com/xsltstylesheets/defa ult.aspwww.topxml.com/xsltstylesheets/defa ult.asp


Download ppt "Transforming XML Part II XML Document Transformation with XSLT John Arnett, MSc Standards Modeller Information and Statistics Division NHSScotland Tel:"

Similar presentations


Ads by Google