XSL Presentation

download XSL Presentation

of 23

Transcript of XSL Presentation

  • 8/3/2019 XSL Presentation

    1/23

    Ahsun Taquveem Chohan

  • 8/3/2019 XSL Presentation

    2/23

    XSL stands for EXtensible StylesheetLanguage, and is a style sheet languagefor XML documents.

    XSL consists of three parts: XSLT - a language for transforming XML

    documents

    XPath - a language for navigating in XML

    documents XSL-FO - a language for formatting XML

    documents

  • 8/3/2019 XSL Presentation

    3/23

    In the transformation process, XSLT usesXPath to define parts of the sourcedocument that should match one or morepredefined templates. When a match isfound, XSLT will transform the matchingpart of the source document into the result

    document.

  • 8/3/2019 XSL Presentation

    4/23

    The root element that declares the documentto be an XSL style sheet is or

    To get access to the XSLT elements,attributes and features we must declare theXSLT namespace at the top of the document.

  • 8/3/2019 XSL Presentation

    5/23

    We wantto transform thisXML document

    ("cdcatalog.xml") intoXHTML

    Create an XSL StyleSheet

    Link the XSL StyleSheet to the XMLDocument

  • 8/3/2019 XSL Presentation

    6/23

    Create an XSL Style Sheet

  • 8/3/2019 XSL Presentation

    7/23

    Link the XSL Style Sheetto the XML Document

  • 8/3/2019 XSL Presentation

    8/23

    An XSL style sheet consists of one or more set ofrules that are called templates.

    A template contains rules to apply when aspecified node is matched.

    The element is used to buildtemplates. The match attribute is used to associate a

    template with an XML element. The match attributecan also be used to define a template for the entire

    XML document. The value of the match attribute isan XPath expression (i.e. match="/" defines thewhole document).

  • 8/3/2019 XSL Presentation

    9/23

  • 8/3/2019 XSL Presentation

    10/23

    The element can be used toextract the value of an XML element andadd it to the output stream of thetransformation

  • 8/3/2019 XSL Presentation

    11/23

  • 8/3/2019 XSL Presentation

    12/23

    The XSL element can beused to select every XML element of aspecified node-set

  • 8/3/2019 XSL Presentation

    13/23

  • 8/3/2019 XSL Presentation

    14/23

    Filtering the Output Legal filter operators

    are: = (equal)

    != (not equal) < less than

    > greater than

  • 8/3/2019 XSL Presentation

    15/23

    To sort the output, simply add an element inside the elementin the XSL file

  • 8/3/2019 XSL Presentation

    16/23

  • 8/3/2019 XSL Presentation

    17/23

    To put a conditional if test against thecontent of the XML file, add an element to the XSL document.

  • 8/3/2019 XSL Presentation

    18/23

  • 8/3/2019 XSL Presentation

    19/23

    The element is used inconjunction with and to express multipleconditional tests.

  • 8/3/2019 XSL Presentation

    20/23

  • 8/3/2019 XSL Presentation

    21/23

    The element appliesa template to the current element or to thecurrent element's child nodes.

    If we add a select attribute to the element it willprocess only the child element thatmatches the value of the attribute. We canuse the select attribute to specify the orderin which the child nodes are processed.

  • 8/3/2019 XSL Presentation

    22/23

  • 8/3/2019 XSL Presentation

    23/23

    XSLT Elements http://www.w3schools.com/xsl/xsl_w3celementref.asp

    XSLT Functions http://www.w3schools.com/xsl/xsl_functions.asp

    XSLT Examples http://www.w3schools.com/xsl/xsl_examples.asp

    XSLT Tutorial http://www.w3schools.com/xsl/default.asp

    http://www.w3schools.com/xsl/xsl_w3celementref.asphttp://www.w3schools.com/xsl/xsl_functions.asphttp://www.w3schools.com/xsl/xsl_examples.asphttp://www.w3schools.com/xsl/default.asphttp://www.w3schools.com/xsl/default.asphttp://www.w3schools.com/xsl/xsl_examples.asphttp://www.w3schools.com/xsl/xsl_functions.asphttp://www.w3schools.com/xsl/xsl_w3celementref.asp