Download presentation
Presentation is loading. Please wait.
Published byMabel Kelly Modified over 9 years ago
1
MC 365 – Software Engineering Presented by: John Ristuccia Shawn Posts Ndi Sampson XSLT Introduction BCi
2
Background Title: EE and DC What is XSLT? XSLT stands for Extensible Stylesheet Language Transformations XSLT is designed for use as part of XSL, which is a stylesheet language for XML. What is XML and why does it need XSL Extensible Markup Language is a set of semantic rules designed to break up a document into hierarchical and easily identifiable parts. XML Has three important features… What can BCi Do?What can BCi Do?
3
Background Continued Title: EE and DC XML is a meta-markup language Instead of having a specified set of tags to draw from, you define your own as you need them; allowing for immense versatility and Domain-specific markup languages. XML Follows a Strict hierarchical structure. Every well-formed XML document is a tree; having a root, children, and leaves. Nodes can be elements, text, attributes, comments, processing instructions, or namespaces. XML contains only structural and semantic info XML documents contain no formatting information – hence XSL/XSLT. What can BCi Do?What can BCi Do?
4
Background Continued Title: EE and DC To Reiterate XSL (Extensible Stylesheet Language) provides a language for adding formatting and structure to an XML document. The process of XSL Transformation basically takes in one XML document and transforms it into a different XML document (usually but not always a well-formed HTML document viewable by a web browser) What can BCi Do?What can BCi Do?
5
Advantages and Disadvantages Title: EE and DC Advantages Easy to merge data into XML data into a presentation More resilient to change in the details of the XML document than in the low-level DOM (Document Object Model) and SAX (Simple API for XML) Database inquiries can be returned in XML Insensitive to column order Disadvantages Memory intensive and suffers a performance penalty Difficult to implement complicated business rules Have to learn a new language Can’t change the value of variables (requires recursion) What can BCi Do?What can BCi Do?
6
XSL Transformations Title: EE and DC Use X-Path to identify (select) parts of an XML document XSLT Templates to apply transformations Requires Well formed XML document XSL document (stylesheet) that contains formatting and transformation templates XSLT parser to perform the transformations What can BCi Do?What can BCi Do?
7
Steps for Translating a Document Title: EE and DC 1.Tell a system which parser to use 2.Establish a factory in which to create transformations 3.Create a transformer for a particular style sheet 4.Invoke the transformer to process the document What can BCi Do?What can BCi Do?
8
Title: EE and DC Who can use BCi?Who can use BCi? XSLT Example <- XML <- XSL XSLT -> Another example
9
XSLT Stylesheet Elements Title: EE and DC Matching and Selecting Templates xsl:template xsl:apply-template xsl:value-of Branching Elements xsl:for-each xsl:if xsl:choose What can BCi Do?What can BCi Do?
10
Example of xsl:if Title: EE and DC xsl:if test = “expression” Evaluate the expression to a boolean and if true, applies the template body XSLT has not else if construct (use choose) What can BCi Do?What can BCi Do?
11
Title: EE and DC Copying: xsl:copy, copies the current node xsl:apply-templates, processes the children of the current node ex. xsl:copy-of element, can copy the entire subtree of each node that the template selects ex. Requirements?Requirements? Some Simple XSLT
12
Some More Simple XSLT Potential Problems?Potential Problems? Deleting: While a match value of "project" would delete all the project elements from the output, the match value shown will only delete project elements whose status attributes have the string "canceled" as their value.
13
Some More Simple XSLT Changing Element Names: ex. This template rule tells an XSLT processor to take any “article” element fed to it as input, and output its contents surrounded by html tags
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.