Introduction BCi - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Introduction BCi

Description:

XSLT is designed for use as part of XSL, which is a stylesheet language for XML. What is XML and why does it ... xsl:template match='nickname' /xsl:template ... – PowerPoint PPT presentation

Number of Views:151
Avg rating:3.0/5.0
Slides: 14
Provided by: taeeu
Category:

less

Transcript and Presenter's Notes

Title: Introduction BCi


1
Introduction BCi
XSLT
MC 365 Software Engineering
Presented by John Ristuccia Shawn Posts Ndi
Sampson
2
Title EE and DC
What can BCi Do?
Background
  • 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

3
Title EE and DC
What can BCi Do?
Background Continued
  • 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.

4
What can BCi Do?
Title EE and DC
Background Continued
  • 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)

5
What can BCi Do?
Title EE and DC
Advantages and Disadvantages
  • 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
  • Cant change the value of variables (requires
    recursion)

6
Title EE and DC
What can BCi Do?
XSL Transformations
  • 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

7
Title EE and DC
What can BCi Do?
Steps for Translating a Document
  • Tell a system which parser to use
  • Establish a factory in which to create
    transformations
  • Create a transformer for a particular style sheet
  • Invoke the transformer to process the document

8
Who can use BCi?
Title EE and DC
XSLT Example
lt- XML
lt- XSL
XSLT -gt
Another example
9
Title EE and DC
What can BCi Do?
XSLT Stylesheet Elements
  • Matching and Selecting Templates
  • xsltemplate
  • xslapply-template
  • xslvalue-of
  • Branching Elements
  • xslfor-each
  • xslif
  • xslchoose

10
Title EE and DC
What can BCi Do?
Example of xslif
  • xslif test expression
  • Evaluate the expression to a boolean and if
    true, applies the template body
  • XSLT has not else if construct (use choose)
  • ltxsltemplate match ROWgt
  • lt!-- select first node in the node set --gt
  • ltxslif test position() first()gt
  • ltxslvalue of select . /gt
  • lt/xslifgt
  • lt/xsltemplategt
  • ltxsltemplate match ROWgt
  • lt! Select if current node has children --gt
  • ltxslif test node()gt
  • ltxslapply-templates/gt
  • lt/xslifgt
  • lt/xsltemplategt

11
Requirements?
Title EE and DC
Some Simple XSLT
  • Copying
  • xslcopy, copies the current node
  • xslapply-templates, processes the children of
    the current node
  • ex. ltxslstylesheetxmlnsxsl"http//www.w3.org/1
    999/XSL/Transform" version"1.0"gt
  • ltxsltemplate match"title"gt
  • ltxslcopygt
  • ltxslapply-templates/gt
  • lt/xslcopygt
  • lt/xsltemplategt
  • lt/xslstylesheetgt
  • xslcopy-of element, can copy the entire subtree
    of each node that the template selects
  • ex. ltxsltemplate match"titlegt
  • ltxslcopy-of select""/gt
  • lt/xsltemplategt

12
Potential Problems?
Some More Simple XSLT
  • Deleting
  • ltxsltemplate match"nickname"gt
  • lt/xsltemplategt
  • ltxsltemplate match"project_at_status'canceled'"gt
    lt/xsltemplategt
  • 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.
  • ltxsltemplate match"article"gt
  • lthtmlgt
  • ltxslapply-templates/gt
  • lt/htmlgt
  • lt/xsltemplategt
  • 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
Write a Comment
User Comments (0)
About PowerShow.com