Your SlideShare is downloading. ×
0
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Overview of XSL, XPath and XSL-FO

542

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
542
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Overview of XSLT, XPATH, and XSL-FO(Beginner Level) Adena FrazerSuite Solutions
  • 2. Overview of XSLMain Topics
  • What is XSL?
    • XSL – Extensible Stylesheet Language
    • 7. “A family of transformation languages which allows one to describe how files encoded in the XML standard are to be formatted or transformed” (Wikipedia).
    • 8. Written in valid XML (Extensible Markup Language), which requires matching starting and ending tags around content.
    <xml>Sample</xml>
    • Includes:
    XPATH -XML Path Language (not XML)
    XSL-FO - XSL Formatting Objects
    XSLT - XSL Transformations
  • 9. Overview of XSLMain Topics
  • XPATH
    Language used to select information from an XML document
    Based on relationships between nodes (which include elements and attributes)
    Parents, Children, Siblings, Ancestors, Descendants
    Can contain expressions, which calculate and compare values using operators.
    Operator Reference:
    http://www.w3schools.com/xpath/xpath_operators.asp
    Can contain built-in functions
    Function Reference: http://www.w3schools.com/xpath/xpath_functions.asp
    Nodes can be referenced using full syntax or abbreviated syntax.
  • 14. XPATH Syntax (Full)
    Axis – defines a nodeset relative to a current node
    • For more details and examples, see: http://www.w3schools.com/xpath/xpath_axes.asp
  • XPATH Syntax (Abbreviated)
  • 15. XPATH Examples (1)
    XPATH is used by XSLT to retrieve information from an XML document
    Variable values
    Test conditions
    Template matches
    Example (from commons.xsl line 160):
    From a node that is the current node’s ancestor
    This expression will be true if the condition inside of the parentheses is false [if no nodes match this description]
    Get any node
    Whose class attribute contains the text ‘ topic/topic ‘
  • 16. XPATH Examples (2)
    • Example (from code that checks if an item is last in a list):
    Evaluate to true if the preceding node count is zero; otherwise evaluate to false
    Get any node
    Count how many nodes meet this criteria:
    From a node which is a sibling to the current node and comes after the current node
    • Example (from commons.xsl line 67):
    From the first node the meets the preceding criteria
    From a node that is the current node or the current node’s ancestor
    Get any node
    Whose class attribute contains the text ‘ topic/topic ‘
    Get the value of the id attribute
  • 17. Overview of XSLMain Topics
  • XSL-FO Overview
    A unified presentation language which stores both the content of the document and the document’s formatting information.
    Intended for documents with pages, as opposed to other languages such as HTML
    Generally used as the stage before PDF format
    The document is converted to PDF using a Formatting Object Processor
    The FO Plug-in uses a .fo extension for XSL-FO Files
    Required components of an FO document:
  • 22. XSL-FO:Document Components
    Required components of an FO document:
    XML Declaration
    XSL-FO is a type of XML
    • Root Node
    • 23. Contains the whole document, including the Page Layout and Document Data sections
    • 24. Declares the XSL-FO Namespace
  • XSL-FO:Document Components
    Page Layout
    Defines the properties of a page, including the size, margins and direction of the text flow
    There can be many simple-page-masters - one for each type of page
  • 25. XSL-FO:Document Components
    Document Data
    References a master-reference which is defined in the Page Layout section
    Uses flows to define which part of the page should be used
    Legal values: xsl-region-body, xsl-region-before, xsl-region-after, xsl-region-start, xsl-region-end
    Contains the content of the page which is formatted using blocks and inline objects.
  • 26. Margin Top
    Region Before
    Region Body
    Region Start
    Region End
    Margin Right
    Margin Left
    Region After
    Margin Bottom
    XSL-FO Page Layout
    • Page Layout Diagram for a Left to Right and Top to Bottom Text Flow (defined by writing mode attribute)
    • 27. Diagram is different for different text flows
  • XSL-FO Elements
    XSL-FO has many elements which are used to format the document. All elements should be preceded by the fo: prefix.
    These elements include:
    Table elements: table, table-body, table-cell table-row, table-and-caption, table-caption, table-footer, table-header, table-column
    List elements – list-block, list-item, list-item-body, list-item-label
    Block elements: block, block-container
    Inline elements: inline, inline-container
    Page-Number: represents the current page-number
    Leader: repeats the specified character
    Formatting Objects Reference: http://www.w3schools.com/xslfo/xslfo_reference.asp
  • 28. XSL-FO Attributes
    Each element in XSL-FO has a corresponding set of attributes
    These include:
    Widow and orphans: keep-with-next, keep-with-previous, keep-together, widows, orphans
    Colors: background-color, color
    Font size and style: font-family, font-weight, font-style, font-size
    Borders: border-after-color, border-after-style, border-after-width…
    Spacing: padding-after, padding-left, padding-right, margin-left, margin-right, margin-bottom, margin-top
  • 29. Overview of XSLMain Topics
  • XSLT (Extensible Stylesheet Language Transformations)
    Used to transform XML documents (such as DITA) into XML (such as XHTML, XSL-FO) or other documents (such as text).
    XSLTStylesheet
    XSLT Engine / Software / Browser
    New Document
    Source XML Document
  • 34. XSLT (Extensible Stylesheet Language Transformations)
    XSLT style sheets- contain the formatting and logic of the document. The same style sheets can be reused with any content.
    Original XML document - contains the content.
    Style sheets can be applied to the content via:
    An XSLT compliant browser such as IE6+
    Software such as Cooktop
    http://www.xmlcooktop.com/
    XSL files end with .xsl (or .xslt) extensions
    Much of the internal workings of the Toolkit and the Plug-in as well as Toolkit and Plug-in customizations are implemented using XSLT.
  • 35. XSLT ElementsAttribute Sets, Templates
    The main units of code that the FO Plug-in uses to process DITA are attribute sets and templates.
    Attribute Set - a unit of code that primarily stores information about how to formata DITA element.
    Example: an attribute set which relates to a <p> element may store information about which font, font size, and font weight should be used to display text surrounded by <p> tags.
    Template – a unit of code that primarily contains instructions about how to process the DITA.
    Example: a template which relates to a <p> element may contain instructions about when and where to display auto-generated text and what that text should be.
  • 36. XSLT ElementsAttribute Sets, Templates
    • Attribute – an XSLT element that corresponds to a single XSL-FO attribute. The name of the XSLT attribute corresponds to the XSL-FO attribute name, and the text surrounded by the XSLT attribute tags corresponds to the XSL-FO attribute value.
    Example (from commons-attr.xsl line 419):
    • Attribute Set – contains a group of attributes.
    • 37. Example (from commons-attr.xsl line 418):
  • XSLT ElementsAttribute Sets, Templates
    Template –contains instructions about how to process the XML content defined by the template’s match attribute.
    Example (from commons.xsl line 1625):
    • Matches XML elements whose class attribute contains the text ‘ topic/ph ‘
    • 38. Puts the content of those elements inside of an XSL:FO <inline> tag
    • 39. Identifies the attributes in the “ph” attribute set as attributes of the XSL-FO inline element
  • XSLT Elements:Attribute Sets, Templates
    • Example
    • 40. Original XML Content:
    • 41. Code is processed using the template and attribute set from the previous slides
    • 42. XSL-FO Output:
  • Overview of XSLMain Topics
  • XSL Resources (1)
    Email Lists
    Mulberry Technologies XSL Email List
    http://www.mulberrytech.com/xsl/xsl-list/subscribe-unsubscribe.html
    Dita-Users email list (for Toolkit / Plug-in related questions)
    http://tech.groups.yahoo.com/group/dita-users/
    W3C Documentation
    XSL Version 1.0
    http://www.w3.org/TR/2001/REC-xsl-20011015/
    XSL Version 1.1
    http://www.w3.org/TR/2006/REC-xsl11-20061205/
    XPATH Version 1.0
    http://www.w3.org/TR/xpath
    XPATH Version 2.0
    http://www.w3.org/TR/2007/REC-xpath20-20070123/
    XPATH Functions and Operators Reference
    http://www.w3.org/TR/xpath-functions/
  • 47. XSL Resources (2)
    Other Websites
    W3Schools Tutorials and References
    XSLT:http://www.w3schools.com/xsl/default.asp
    XSL-FO:http://www.w3schools.com/xslfo/default.asp
    XPath:http://www.w3schools.com/xpath/default.asp
    XSLT Reference
    http://www.zvon.org/xxl/XSLTreference/Output/
    Dave Pawson’s XSL FAQ
    http://www.dpawson.co.uk/xsl/
    Wikipedia
    http://www.wikipedia.org/
  • 48. Overview of XSLMain Topics
  • End of Session: Overview of XSLT, XPATH, and XSL-FO (Beginner Level)

×