Example: tourism industry

Introduction to XSLT Concepts - Mulberry Tech

Introduction to xslt ConceptsDeborah Aleyne Lapeyre and B. Tommie Usdin Mulberry Technologies, West Jefferson St., Suite 207 Rockville, MD 20850 Phone: 301/315-9631 Fax: January 2006 2006 Mulberry Technologies, to xslt is What xslt Does is Transform ..5 The Very Basics of xslt Sample xslt TransformsLogical Components of an xslt Component 1: XML Looking at an XML Document as a Component 2: The xslt Stylesheet (aka xslt Transform)..11 An XSL Stylesheet / Component 3: An xslt Component 4: The Output File(s)..16 Watching a Stylesheet in Operation How Input-Driven Stylesheets : What to Do and Not Do with Business Uses xslt Because XML is For the Right Kind of Problems* ..17 What s Really Easy in xslt Easily Changes XML into Different xslt Handles Markup is Not Good at xslt is Weak on Manipulating Text (Strings).

Introduction to XSLT Concepts Deborah Aleyne Lapeyre and B. Tommie Usdin Mulberry Technologies, Inc. 17 West Jefferson St., Suite 207 Rockville, MD 20850

Tags:

  Introduction, Concept, Xslt, Introduction to xslt concepts

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of Introduction to XSLT Concepts - Mulberry Tech

1 Introduction to xslt ConceptsDeborah Aleyne Lapeyre and B. Tommie Usdin Mulberry Technologies, West Jefferson St., Suite 207 Rockville, MD 20850 Phone: 301/315-9631 Fax: January 2006 2006 Mulberry Technologies, to xslt is What xslt Does is Transform ..5 The Very Basics of xslt Sample xslt TransformsLogical Components of an xslt Component 1: XML Looking at an XML Document as a Component 2: The xslt Stylesheet (aka xslt Transform)..11 An XSL Stylesheet / Component 3: An xslt Component 4: The Output File(s)..16 Watching a Stylesheet in Operation How Input-Driven Stylesheets : What to Do and Not Do with Business Uses xslt Because XML is For the Right Kind of Problems* ..17 What s Really Easy in xslt Easily Changes XML into Different xslt Handles Markup is Not Good at xslt is Weak on Manipulating Text (Strings).

2 19 Really Big Making Flat Files into xslt Fits in How Organizations Use Simple Business Making HTML From Semantically Richer Page iIntroduction to xslt Concepts Single Source and Reuse Construct the Output for What You Want in the Order You Want There is Not Just One Print Some of the Text is Added by the Large Structures Can be Built and Inserted as xslt is Also Useful During XML for Interchange and xslt as the Middle Component in How XSL-FO Architecture of a Full XSL System ( xslt + XSL-FO)..32 Formatting Objects Describe Page Applying Styles through XSL XSL-FO is a Great Report Last What is XPath Has Two Main You ve Seen XPath in match Expressions.

3 35 XPath Can Be Very Another Complexity: Push-me Pull-you Stylesheets What is a Pull Stylesheet?..37 Why Pull Can Be a UP: xslt and XPath , , What Was Wrong with xslt xslt : More Power; More Programmer How to Deal with xslt and (November 2005)..42 How to Make xslt xslt is Also Really Easy How to Learn Debbie's xslt Programming Pearls (Optional)..45 Page iiIntroduction to xslt ConceptsNow Let s Look at Some Real Speech; Start References For Further xslt Technical Reference Useful xslt Reference Website: xslt concept /Syntax xslt Syntax+ for 1: Representative xslt 2: Acronyms Used in This iiiIntroduction to xslt Conceptsslide 1 AdministriviaCStart, end, breakCAsk questions any time (please!)

4 CWho we areCWhy this classCWhy more publishing examplesCAnything else?slide 2 Where We Are Not Going in This TutorialCWhat is XML, why you should care, how XML works(element, attribute, DTD, schema, entity)CHow to solve your particular business problem(s)CProgrammer stuff like how to write stylesheets (although you will see some code)CSyntax of the xslt language (templates, functions, location paths)CDetailed XPath syntax (location paths, functions, data types)CXSLT toolsCXSL-FO in depth (that s this afternoon)Page 1 Introduction to xslt Conceptsslide 3 Where We Are Going TodayThe What and Why of XSLTCWhat is transformation, what is XSLTCHow it works (logical components of an xslt system)CHow to think about it (the xslt processing model)CHow businesses are using XSLTCWhat xslt does not do wellCHow should you learn/write xslt slide 4 WARNING!

5 We are going to show code!You ll understand the examples even if you ignore the codeWe are going to act as if you never heard of xslt and start from scratchPage 2 Introduction to xslt Conceptsslide 5A Quick Poll (Who You Are)CWhere in the processCcontent creators / editors / publishersCprepress / compositionCprintersCprint / web / graphic designCfulfillment / distributionCSystem analysts / application programmersCTrainingCWhat kind of publishingCBooks (monographs, reference series, etc.)CJournalsCMagazines and newspapersCProduct documentationCTechnical documentationCCourse materials (CBT, course-packages, tests, textbooks plus, etc.)CNon-publishing folksPage 3 Introduction to xslt Conceptsslide 6 What Do You Know Now?CKnow HTML (even a little)CXMLCSGMLCXSLTCXSL-FOCM icrosoft Word, WordPerfectCQuarkXPress, InDesign, other desktop publishingCHigh-end composition systemsslide 7 What is XSLTE xtensible Stylesheet Language TransformationCName is misleadingCStylesheetCimplies it makes things look like somethingCnot necessarily or usually trueCName should have been The XML Transformation Language Page 4 Introduction to xslt Conceptsslide 8So What is xslt Really?

6 CProvides transformation and manipulation functions for XML filesCDesigned to make XML into something W3C Recommendation Candidate Recommendation November 2005slide 9 What xslt Does is Transform Transform means changeReads XML documents and writesCHTML for browsersCa different XML tag setCtypesetting driver file (InDesign, QuarkXPress, FrameMaker)Cinterchange file (RTF, RDF, EDI, etc.)Ca flat ASCII file (plain text, comma separated etc.)Page 5 Introduction to xslt Conceptsslide 10 The Very Basics of xslt TransformsCTransformCdoes not change the input fileCcreates one (or more) new output filesCTransform does not make something else into XMLCTwo basic requirementsCknown XML source (tag set, schema, DTD)Cknown targetSample xslt Transformsslide 11 Take in an XML document<employee-record type="dog" empno="9"> <name> <first>Sasparilla</first> <last>Usdin</last> </name> <affiliation> <title>Deputy in Charge of Chewables</title> <company> Mulberry Technologies</company> <location> <city>Rockville</city> <state>MD</state> <zip>20850</zip> </location> <email-name>sassy</email-name> </affiliation> <height unit="in">36</height> <weight unit="lb">70</weight> </employee-record>Page 6 Introduction to xslt Conceptsslide 12 Transform It into HTML(convert to HTML and display in a browser)slide 13 Transform It into PDF(convert to PDF and display with Acrobat)Page 7 MulberryTechnologies, Usdin17 West Jefferson StreetSuite 207 Rockville, MD 20850 Phone: 301/315-9631 Fax.

7 To xslt Conceptsslide 14 Transform It into QuarkXPressCXML elements rolled into form letter CSomething (perhaps employee-id) linked to photoslide 15 Transform It into a Database Load FileKey: 00095 AUSEMPNO: 009001:USDIN002:Sasparilla008:36014:7002 0:Deputy in Charge of ChewablesPage 8 NewEmployeeAnnouncementsSasparilla Usdin has recently joined Mulberry Technologies, Inc. s Rockville staff as Deputy in Charge of to the team, Sassy! Introduction to xslt Conceptsslide 16In Other Words: Tagging Changes Large and SmallCChange the following<surname>Lapeyre</surname> <firstnames>Deborah A.</firstnames>INTO<contrib>Deborah A. Lapeyre</contrib>CChange the following<chapter> <title>Lawns and Gardens</title>INTO<h2>Lawns and Gardens</h2>C<bold>Tall</bold>..INTO:G46 Helvetica-ExtraBold.

8 Tallslide 17 Logical Components of an xslt Application(needs xslt processing software (called an xslt Engine )CReads XML document(s) (tags and text)CUses an xslt stylesheet/transform (the program)CRuns using xslt processing software (called an xslt Engine)CProduces output document(s)Page 9 Structure of an xslt SystemXSLT stylesheetXSLT processoroutputfileXMLfileIntroduction to xslt Conceptsslide 18 Component 1: XML DocumentCXML documentsCare sequences of data characters and markupCstart-tag and end-tag markup delimits elementsCBut xslt does not work directly on XML documentsCPart of the xslt processing (usually an XML parser) builds a treeCXSLT works on trees (made from XML documents)Page 10 Introduction to xslt Conceptsslide 19 Looking at an XML Document as a Treeslide 20 Component 2: The xslt Stylesheet (aka xslt Transform)CA computer programCTransformation instructionsCCalled a stylesheet (or a transform )CA well-formed XML document!)

9 CCommands in the xslt language areCa tag set (elements and attributes)Cdefined by the W3C xslt recommendationCthat look like this (<xsl:sort> and <xsl:number>)Page 11 Introduction to xslt Conceptsslide 21An xslt Stylesheet / Transform IsCA series of rules (called template rules)CEach rule is a sequence of xslt commandsCEach command is an XML element with attributesCA rule is executed when it Cmatches some conditionCor is called by nameslide 22 Matching a Condition MeansCIf you find a (_____) in the source XML,then do this (perform the template)CMatching can mean finding in the XMLCan elementCan element/attribute combinationCan element in a certain contextCsome special circumstance(words in the content, any element at all, etc.)Page 12 Introduction to xslt Conceptsslide 23An XSL Stylesheet / Transform(close your eyes, this is code)CHere is a template ruleCThis rule matches a <paragraph> elementCNotice that it is made up of XML elements (two kinds)CThe two kinds of XML elementsCXSLT language tags (instructions)CHTML tags1 <xsl:template match="paragraph">2 <hr/>3 <p>4 <xsl:apply-templates/>5 </p>6 </xsl:template>Page 13 Introduction to xslt Conceptsslide 24 Component 3: An xslt Engine/ProcessorCYou need special software to run XSLTCBut you don t have to buy themCFree open-source, shareware, as well as commercialCNew ones all the timeCLook for more at.

10 ( )CXalan xslt ( )CUnicorn xslt Processor ( )CXSLT C library for Gnome ( )slide 25 xslt Also Built Into/Can be Hooked IntoCXML programmers developing environmentsCXML-aware editorsCContent aggregation systemsCOther XML processorsIn softwares like this xslt comes built in and you still don t have to buy it!Page 14 Introduction to xslt Conceptsslide 26 How an xslt Processor WorksThe big dark rectangle above is the xslt processorPage <z>XSL is <e>fun</e> </z>..<t>XSL is </t>"fun"..<xsl:stylesheet>..</xsl:stylesheet> Introduction to xslt Conceptsslide 27 Component 4: The Output File(s) xslt can make 3 syntaxes for outputCXML filesCHTMLCText (untagged files)CASCII email messageCcomma-separated fileCdesktop publishing system format ( , XTags for QuarkXPress)Watching a Stylesheet in Operationslide 28 How Input-Driven Stylesheets WorkPage 16 Introduction to xslt Conceptsslide 29 Advice.


Related search queries