SlideShare a Scribd company logo
1 of 33
Extensible Markup Language
Objectives


                In this session, you will learn to:
                   Transform an XML document through a Cascading Style Sheet
                   Transform an XML document through Extensible Style Sheet
                   Language




     Ver. 1.0                      Session 5                        Slide 1 of 33
Extensible Markup Language
Introducing Cascading Style Sheet


                A CSS is a text file containing one or more rules or
                definitions for the style characteristics of a particular
                element.
                It controls how tags are formatted in XML and HTML
                documents.
                The CSS file can be included in XML documents with the
                same data structure.




     Ver. 1.0                    Session 5                           Slide 2 of 33
Extensible Markup Language
Creating CSS


                •   The syntax for coding a CSS is:
                                                      elementname specifies the
                    elementname {                     name of the element.
                    property1: value;
                    property2: value;
                    }




     Ver. 1.0                        Session 5                         Slide 3 of 33
Extensible Markup Language
Creating CSS (Contd.)


                •   The syntax for coding a CSS is:
                                                      property1 and property2
                    elementname {                     specify the property names,
                    property1: value;                 such as font-family, font-size,
                                                      and color
                    property2: value;
                    }




     Ver. 1.0                        Session 5                             Slide 4 of 33
Extensible Markup Language
Creating CSS (Contd.)


                •   The syntax for coding a CSS is:
                                                                             value specifies the property
                    elementname {                                            values for a property name.
                    property1: value;
                    property2: value;
                    }


                    For example, to display the film title in red, you can
                    type the following code in a CSS file:
                          FILM {COLOR: RED}




     Ver. 1.0                                Session 5                                          Slide 5 of 33
Extensible Markup Language
Applying CSS


                A CSS can be applied to an XML
                document using the following
                syntax:                          Instructs the browser that the
                <?xml:stylesheet                 XML document uses a
                                                 stylesheet.
                type="text/css" href="path-
                name"?>




     Ver. 1.0                   Session 5                             Slide 6 of 33
Extensible Markup Language
Applying CSS (Contd.)


                A CSS can be applied to an XML
                document using the following
                syntax:                          Specifies the type of
                <?xml:stylesheet                 formatting that is being used.

                type="text/css" href="path-
                name"?>




     Ver. 1.0                   Session 5                             Slide 7 of 33
Extensible Markup Language
Applying CSS (Contd.)


                A CSS can be applied to an XML
                document using the following
                syntax:                          Specifies the name of the
                <?xml:stylesheet                 CSS file used to format the
                                                 XML document.
                type="text/css" href="path-
                name"?>




     Ver. 1.0                   Session 5                            Slide 8 of 33
Extensible Markup Language
Demo: Creating a CSS


                Problem Statement:
                   Jim, the XML developer at CyberShoppe, has been asked to
                   display the product details for Cybershoppe in a browser in the
                   following format:
                      The price per unit, description, and quantity on hand for each
                      product should be displayed in teal, with a font size of 10 pts.
                      The product name should be displayed in red, with a font size of
                      20 pts. It should be displayed in bold.
                      All details should be displayed in the Arial font.




     Ver. 1.0                      Session 5                                   Slide 9 of 33
Extensible Markup Language
Introducing XSL


                CSS does not support the reorder, sort, and display of
                elements based on a condition.
                For such advanced formatting, XML supports Extensible
                Style Sheet Language (XSL).
                XSL has two parts:
                   XSL Transformations (XSLT)
                   XML Path (XPath)
                XSL:
                   Contains instructions on how an XML document should be
                   transformed into an HTML or an XHTML document.
                   Uses XPath expressions to extract specific data from an XML
                   document.
                The XSLT processor transforms the XML document into an
                HTML or XHTML or into another XML document.

     Ver. 1.0                     Session 5                            Slide 10 of 33
Extensible Markup Language
Analyzing the Working of the XSLT Processor


                      The XSLT processor applies the transformation information
                      to the source document and builds the result tree as shown
                      in the following figure.



                                         MSXML Parser

                XSLT style sheet            XSLT tree



                                              XSLT               Result tree
                                             processor




                XML document                Source tree




     Ver. 1.0                          Session 5                               Slide 11 of 33
Extensible Markup Language
Formatting Data Using XSLT


                XSLT provides the following elements to select and format
                data:
                   stylesheet
                   value-of
                   for-each
                   sort
                   text




     Ver. 1.0                    Session 5                         Slide 12 of 33
Extensible Markup Language
Formatting Data Using XSLT (Contd.)


                XSLT provides the following elements to select and format
                data:
                                           Instructs the browser that the document is a style
                a   stylesheet           sheet file.
                a   value-of               Is the root element for all XSLT style sheets.
                a   for-each               Is written as:
                                         <xsl:stylesheet
                a   sort                  xmlns:xsl=
                a   text                  "http://www.w3.org/1999/XSL/Transform"
                                          version="1.0">




     Ver. 1.0                    Session 5                                       Slide 13 of 33
Extensible Markup Language
Formatting Data Using XSLT (Contd.)


                XSLT provides the following elements to select and format
                data:
                a   stylesheet
                a   value-of               Displays the value of the specified element or
                a                        attribute.
                    for-each
                                           Follows the syntax:
                a   sort                 <xsl:value‑of
                a   text                  select="elementname/attributename"/>




     Ver. 1.0                    Session 5                                      Slide 14 of 33
Extensible Markup Language
Formatting Data Using XSLT (Contd.)


                XSLT provides the following elements to select and format
                data:
                a   stylesheet
                a   value-of
                a   for-each             Instructs the XSLT processor to process the
                                       information for each instance of the specified pattern.
                a   sort
                                         Follows the syntax:
                a   text               <xsl:for-each select="pattern">
                                       [action to be performed]
                                       </xsl:for-each>




     Ver. 1.0                    Session 5                                         Slide 15 of 33
Extensible Markup Language
Formatting Data Using XSLT (Contd.)


                XSLT provides the following elements to select and format
                data:
                a   stylesheet
                a   value-of
                a   for-each
                a   sort               Sorts data based on the values assigned to elements
                a   text         and
                                    attributes.
                                     Follows the syntax:
                                    <xsl:sort select="expression"
                                    order="ascending | descending"
                                    case-order="upper-first | lower-first“
                                    data-type="text | number | qname"/>




     Ver. 1.0                    Session 5                                       Slide 16 of 33
Extensible Markup Language
Formatting Data Using XSLT (Contd.)


                XSLT provides the following elements to select and format
                data:
                a   stylesheet
                a   value-of
                a   for-each
                a   sort
                a   text                       Generates constant text in the output and displays
                                             labels.
                                               Follows the syntax:
                                             <xsl:text> Text to be displayed as
                                              label </xsl:text>




     Ver. 1.0                    Session 5                                          Slide 17 of 33
Extensible Markup Language
Formatting Data Using XSL Formatting Objects


                XSL Formatting Objects (XSL-FO):
                   Is an XML-based language that formats XML documents into
                   pages, paragraphs, and lists.
                   Provides various objects and properties that define the
                   formatting of XML objects.
                   Provides a basic document structure that contains the
                   formatting objects and properties.




     Ver. 1.0                    Session 5                           Slide 18 of 33
Extensible Markup Language
Formatting Data Using XSL Formatting Objects (Contd.)


                The following code snippet depicts the structure of an XML
                document:
                Is <?xml version="1.0" encoding="ISO-8859-1"?>
                 <fo:root
                   xmlns:fo="http://www.w3.org/1999/XSL/Format">
                   <fo:layout-master-set>
                    <fo:simple-page-master master-name="A4">
                      <!-- Page template goes here -->
                    </fo:simple-page-master>
                   </fo:layout-master-set>
                   <fo:page-sequence master-reference="A4">
                     <!-- Page content goes here -->
                   </fo:page-sequence>
                </fo:root>

     Ver. 1.0                    Session 5                         Slide 19 of 33
Extensible Markup Language
Formatting Data Using XSL Formatting Objects (Contd.)


                The XSL-FO objects provides a logical layout to an XML
                document.
                The content of an XML document can be split into pages.
                These pages are divided into following four areas:
                a   Regions: Are the topmost areas in the page.
                a   Block areas: Are the block level elements.
                a   Line areas: Contain the text within the block areas.
                a   Inline areas: Are part of line areas.




     Ver. 1.0                       Session 5                              Slide 20 of 33
Extensible Markup Language
Formatting Data Using XSL Formatting Objects (Contd.)


                The XSL-FO properties specifies the type of formatting that
                can be specified on the XSL-FO objects.
                Consider the following code-snippet:
                <fo:simple-page-master master-name="right">
                <fo:region-body margin-left="5in"
                margin-right="2in"/>
                </fo:simple-page-master> This the namedefines a template
                                                  with
                                                       element
                                                               right.

                                                   This specifies that the left margin
                                                   of the template is set to 5 inches.

                                                   This specifies that the right margin
                                                   of the template is set to 2 inches.




     Ver. 1.0                    Session 5                                  Slide 21 of 33
Extensible Markup Language
Creating XSLT Template Rules


                A template rule:
                   Describes how an XML element and its contents are converted
                   into a specific format for displaying in the browser.
                   Consists of two parts:
                     a A pattern that identifies an XML element in an XML document.
                     a An action or processing code that details the transformation and
                       rendering of the resulting element.
                   XSLT uses two main elements for creating template rules:
                     a template
                     a apply-templates




     Ver. 1.0                       Session 5                                   Slide 22 of 33
Extensible Markup Language
Creating XSLT Template Rules (Contd.)


                A template rule:
                   Describes how an XML element and its contents are converted
                   into a specific format for displaying in the browser.
                   Consists of two parts:
                     a A pattern that identifies an XML element in an XML document.
                     a An action or processing code that details the transformation and
                       rendering of the resulting element.
                   XSLT uses two main elements for creating template rules:
                     a template                      Defines a template for the desired
                     a apply-templates              output.
                                                     Follows the syntax:
                                                    <xsl:template match="pattern">
                                                    [action to be taken]
                                                    </xsl:template>




     Ver. 1.0                       Session 5                                   Slide 23 of 33
Extensible Markup Language
Creating XSLT Template Rules (Contd.)


                A template rule:
                   Describes how an XML element and its contents are converted
                   into a specific format for displaying in the browser.
                   Consists of two parts:
                     a A pattern that identifies an XML element in an XML document.
                     a An action or processing code that details the transformation and
                       rendering of the resulting element.
                   XSLT uses two main elements for creating template rules:
                     a template
                     a apply-templates            Instructs the XSLT processor to find an
                                                appropriate template and perform the specified
                                                tasks on selected elements.
                                                  Follows the syntax:
                                                 <xsl:apply‑templates
                                                  [select="pattern"]>




     Ver. 1.0                       Session 5                                      Slide 24 of 33
Extensible Markup Language
Demo: Creating an XSLT Style Sheet to Format Data


                Problem Statement:
                   CyberShoppe needs to display product details, such as product
                   ID, name, and price per unit. The following figure depicts a
                   sample output.




                  The details about the products should be displayed in red.




     Ver. 1.0                     Session 5                              Slide 25 of 33
Extensible Markup Language
Practice Questions


                The various departments of a university store data in
                different formats. The IT department of the university
                decides to use XML as the data interchange format to
                transmit the data between the departments. Which of the
                following would be the best approach to accomplish the task
                using XML?
                a. Devise a common information model and enforce its use by all
                   the departments that need to exchange data.
                b. Implement a conversion application that can handle the data
                   received from other departments.




     Ver. 1.0                     Session 5                            Slide 26 of 33
Extensible Markup Language
Practice Questions (Contd.)


                c. Use an XSLT style sheet to convert the incoming or outgoing
                   XML document into the format used within the departments.
                d. Modify the XML schema to use the same content model in all
                   departments.




                Answer:
                c. Use an XSLT style sheet to convert the incoming or outgoing
                   XML document into the format used within the departments.


     Ver. 1.0                     Session 5                            Slide 27 of 33
Extensible Markup Language
Practice Questions


                • Which of the following code snippets can be used in an
                  XML document named Test.xml to associate it with a
                  style sheet named Test.css?
                   a. <?xml-stylesheet href="Test.css"
                      type="text/css"?>
                   b. <?xml-stylesheet href="Test.xsl"
                      type="text/css"?>
                   c. <?xmlstylesheet href="Test.css"
                      type="text/xsl"?>
                   d. <xml-stylesheet href="Test.css"
                      type="text/css"/>

                  Answer:
                   a. <?xml-stylesheet href=”Test.css”
                      type=”text/css”?>


     Ver. 1.0                      Session 5                        Slide 28 of 33
Extensible Markup Language
Practice Questions


                Consider the following statements:
                Statement A: CSS can be used to reorder, add, delete, or
                perform other operations on elements.
                Statement B: CSS uses less memory when compared to
                XSLT.
                Which of the following is correct about the preceding
                statements?
                a.   Statement A is True, and Statement B is False.
                b.   Statement A is False, and Statement B is True.
                c.   Both, Statement A and Statement B, are True.
                d.   Both, Statement A and Statement B, are False.

                Answer:
                b. Statement A is False, and Statement B is True.

     Ver. 1.0                       Session 5                         Slide 29 of 33
Extensible Markup Language
Practice Questions


                Which element must contain one or more when elements?
                a.   xsl:if
                b.   xsl:for-each
                c.   xsl:sort
                d.   xsl:choose




                Answer:
                d. xsl:choose



     Ver. 1.0                   Session 5                      Slide 30 of 33
Extensible Markup Language
Practice Questions


                Consider the following statements:
                Statement A: XSLT is a superset of the CSS functionality.
                Statement B: XSLT is an application of XML.
                Which of the following is correct about the preceding
                statements?
                 a.   Statement A is True, and Statement B is False.
                 b.   Statement A is False, and Statement B is True.
                 c.   Both, Statement A and Statement B, are True.
                 d.   Both, Statement A and Statement B, are False.


                Answer:
                 c. Both, Statement A and Statement B, are True.



     Ver. 1.0                        Session 5                         Slide 31 of 33
Extensible Markup Language
Summary


               In this session, you learned that:
                  Rendering is the process of formatting and presenting the data
                  in an XML document in different formats.
                  A style sheet is a document that contains the formatting rules
                  for one or several XML documents. The two types of style
                  sheets that can be used with XML documents are:
                     CSS
                     XSL
                 CSS is used to define the style or appearance of an XML
                  document.
                 XSL is made up of XSLT and XPath.
                 XSLT is used to display selective elements or attributes, sort
                  data on one or more elements, and process the data based on
                  conditions.



    Ver. 1.0                      Session 5                             Slide 32 of 33
Extensible Markup Language
Summary (Contd.)


                The XSLT processor applies the transformation information
                 contained in the XSLT style sheet and builds a resultant tree
                 structure, which is then rendered to various targets.
                XSLT elements, such as template, apply-templates,
                 sort, for-each, and value-of are used to extract and
                 format data.
                XSL-FO provides formatting objects to break XML documents
                 into pages, paragraphs, and lists. The associated properties of
                 the formatting objects allow you to format the XML documents.
                A template rule describes how an XML element and its
                 contents are converted into a format that can be displayed in
                 the browser.




    Ver. 1.0                     Session 5                              Slide 33 of 33

More Related Content

Viewers also liked

Aae oop xp_10
Aae oop xp_10Aae oop xp_10
Aae oop xp_10Niit Care
 
15 ooad uml-20
15 ooad uml-2015 ooad uml-20
15 ooad uml-20Niit Care
 
01 intro to programming in .net
01   intro to programming in .net01   intro to programming in .net
01 intro to programming in .netFelisha Hosein
 
Introduction to vb.net
Introduction to vb.netIntroduction to vb.net
Introduction to vb.netSaad Wazir
 
Vb.net session 01
Vb.net session 01Vb.net session 01
Vb.net session 01Niit Care
 

Viewers also liked (7)

Aae oop xp_10
Aae oop xp_10Aae oop xp_10
Aae oop xp_10
 
15 ooad uml-20
15 ooad uml-2015 ooad uml-20
15 ooad uml-20
 
01 intro to programming in .net
01   intro to programming in .net01   intro to programming in .net
01 intro to programming in .net
 
Introduction to vb.net
Introduction to vb.netIntroduction to vb.net
Introduction to vb.net
 
Ajs 4 b
Ajs 4 bAjs 4 b
Ajs 4 b
 
Vb.net session 01
Vb.net session 01Vb.net session 01
Vb.net session 01
 
Ajs 1 b
Ajs 1 bAjs 1 b
Ajs 1 b
 

Similar to Xml session05

Similar to Xml session05 (20)

03 sm3 xml_xp_05
03 sm3 xml_xp_0503 sm3 xml_xp_05
03 sm3 xml_xp_05
 
E05412327
E05412327E05412327
E05412327
 
XPATH_XSLT-1.pptx
XPATH_XSLT-1.pptxXPATH_XSLT-1.pptx
XPATH_XSLT-1.pptx
 
Xml PPT
Xml PPTXml PPT
Xml PPT
 
Session 3
Session 3Session 3
Session 3
 
Xml session01
Xml session01Xml session01
Xml session01
 
XML and Related Technologies - Web Technologies (1019888BNR)
XML and Related Technologies - Web Technologies (1019888BNR)XML and Related Technologies - Web Technologies (1019888BNR)
XML and Related Technologies - Web Technologies (1019888BNR)
 
Web services Overview in depth
Web services Overview in depthWeb services Overview in depth
Web services Overview in depth
 
BizTalk Server- Schema
BizTalk Server-  SchemaBizTalk Server-  Schema
BizTalk Server- Schema
 
Xml data transformation
Xml data transformationXml data transformation
Xml data transformation
 
Er2000
Er2000Er2000
Er2000
 
Displaying XML Documents Using CSS and XSL
Displaying XML Documents Using CSS and XSLDisplaying XML Documents Using CSS and XSL
Displaying XML Documents Using CSS and XSL
 
uptu web technology unit 2 Xml2
uptu web technology unit 2 Xml2uptu web technology unit 2 Xml2
uptu web technology unit 2 Xml2
 
Rendering XML Document
Rendering XML DocumentRendering XML Document
Rendering XML Document
 
Xml session04
Xml session04Xml session04
Xml session04
 
Xml transformation language
Xml transformation languageXml transformation language
Xml transformation language
 
CTDA Workshop on XSL
CTDA Workshop on XSLCTDA Workshop on XSL
CTDA Workshop on XSL
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Artefactos biz talk 2006
Artefactos biz talk 2006Artefactos biz talk 2006
Artefactos biz talk 2006
 
Xslt
XsltXslt
Xslt
 

More from Niit Care (20)

Ajs 4 a
Ajs 4 aAjs 4 a
Ajs 4 a
 
Ajs 4 c
Ajs 4 cAjs 4 c
Ajs 4 c
 
Ajs 3 b
Ajs 3 bAjs 3 b
Ajs 3 b
 
Ajs 3 a
Ajs 3 aAjs 3 a
Ajs 3 a
 
Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
Ajs 2 b
Ajs 2 bAjs 2 b
Ajs 2 b
 
Ajs 2 a
Ajs 2 aAjs 2 a
Ajs 2 a
 
Ajs 2 c
Ajs 2 cAjs 2 c
Ajs 2 c
 
Ajs 1 a
Ajs 1 aAjs 1 a
Ajs 1 a
 
Ajs 1 c
Ajs 1 cAjs 1 c
Ajs 1 c
 
Dacj 4 2-c
Dacj 4 2-cDacj 4 2-c
Dacj 4 2-c
 
Dacj 4 2-b
Dacj 4 2-bDacj 4 2-b
Dacj 4 2-b
 
Dacj 4 2-a
Dacj 4 2-aDacj 4 2-a
Dacj 4 2-a
 
Dacj 4 1-c
Dacj 4 1-cDacj 4 1-c
Dacj 4 1-c
 
Dacj 4 1-b
Dacj 4 1-bDacj 4 1-b
Dacj 4 1-b
 
Dacj 4 1-a
Dacj 4 1-aDacj 4 1-a
Dacj 4 1-a
 
Dacj 1-2 b
Dacj 1-2 bDacj 1-2 b
Dacj 1-2 b
 
Dacj 1-3 c
Dacj 1-3 cDacj 1-3 c
Dacj 1-3 c
 
Dacj 1-3 b
Dacj 1-3 bDacj 1-3 b
Dacj 1-3 b
 
Dacj 1-3 a
Dacj 1-3 aDacj 1-3 a
Dacj 1-3 a
 

Recently uploaded

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 

Recently uploaded (20)

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 

Xml session05

  • 1. Extensible Markup Language Objectives In this session, you will learn to: Transform an XML document through a Cascading Style Sheet Transform an XML document through Extensible Style Sheet Language Ver. 1.0 Session 5 Slide 1 of 33
  • 2. Extensible Markup Language Introducing Cascading Style Sheet A CSS is a text file containing one or more rules or definitions for the style characteristics of a particular element. It controls how tags are formatted in XML and HTML documents. The CSS file can be included in XML documents with the same data structure. Ver. 1.0 Session 5 Slide 2 of 33
  • 3. Extensible Markup Language Creating CSS • The syntax for coding a CSS is: elementname specifies the elementname { name of the element. property1: value; property2: value; } Ver. 1.0 Session 5 Slide 3 of 33
  • 4. Extensible Markup Language Creating CSS (Contd.) • The syntax for coding a CSS is: property1 and property2 elementname { specify the property names, property1: value; such as font-family, font-size, and color property2: value; } Ver. 1.0 Session 5 Slide 4 of 33
  • 5. Extensible Markup Language Creating CSS (Contd.) • The syntax for coding a CSS is: value specifies the property elementname { values for a property name. property1: value; property2: value; } For example, to display the film title in red, you can type the following code in a CSS file: FILM {COLOR: RED} Ver. 1.0 Session 5 Slide 5 of 33
  • 6. Extensible Markup Language Applying CSS A CSS can be applied to an XML document using the following syntax: Instructs the browser that the <?xml:stylesheet XML document uses a stylesheet. type="text/css" href="path- name"?> Ver. 1.0 Session 5 Slide 6 of 33
  • 7. Extensible Markup Language Applying CSS (Contd.) A CSS can be applied to an XML document using the following syntax: Specifies the type of <?xml:stylesheet formatting that is being used. type="text/css" href="path- name"?> Ver. 1.0 Session 5 Slide 7 of 33
  • 8. Extensible Markup Language Applying CSS (Contd.) A CSS can be applied to an XML document using the following syntax: Specifies the name of the <?xml:stylesheet CSS file used to format the XML document. type="text/css" href="path- name"?> Ver. 1.0 Session 5 Slide 8 of 33
  • 9. Extensible Markup Language Demo: Creating a CSS Problem Statement: Jim, the XML developer at CyberShoppe, has been asked to display the product details for Cybershoppe in a browser in the following format: The price per unit, description, and quantity on hand for each product should be displayed in teal, with a font size of 10 pts. The product name should be displayed in red, with a font size of 20 pts. It should be displayed in bold. All details should be displayed in the Arial font. Ver. 1.0 Session 5 Slide 9 of 33
  • 10. Extensible Markup Language Introducing XSL CSS does not support the reorder, sort, and display of elements based on a condition. For such advanced formatting, XML supports Extensible Style Sheet Language (XSL). XSL has two parts: XSL Transformations (XSLT) XML Path (XPath) XSL: Contains instructions on how an XML document should be transformed into an HTML or an XHTML document. Uses XPath expressions to extract specific data from an XML document. The XSLT processor transforms the XML document into an HTML or XHTML or into another XML document. Ver. 1.0 Session 5 Slide 10 of 33
  • 11. Extensible Markup Language Analyzing the Working of the XSLT Processor The XSLT processor applies the transformation information to the source document and builds the result tree as shown in the following figure. MSXML Parser XSLT style sheet XSLT tree XSLT Result tree processor XML document Source tree Ver. 1.0 Session 5 Slide 11 of 33
  • 12. Extensible Markup Language Formatting Data Using XSLT XSLT provides the following elements to select and format data: stylesheet value-of for-each sort text Ver. 1.0 Session 5 Slide 12 of 33
  • 13. Extensible Markup Language Formatting Data Using XSLT (Contd.) XSLT provides the following elements to select and format data: Instructs the browser that the document is a style a stylesheet sheet file. a value-of Is the root element for all XSLT style sheets. a for-each Is written as: <xsl:stylesheet a sort xmlns:xsl= a text "http://www.w3.org/1999/XSL/Transform" version="1.0"> Ver. 1.0 Session 5 Slide 13 of 33
  • 14. Extensible Markup Language Formatting Data Using XSLT (Contd.) XSLT provides the following elements to select and format data: a stylesheet a value-of Displays the value of the specified element or a attribute. for-each Follows the syntax: a sort <xsl:value‑of a text select="elementname/attributename"/> Ver. 1.0 Session 5 Slide 14 of 33
  • 15. Extensible Markup Language Formatting Data Using XSLT (Contd.) XSLT provides the following elements to select and format data: a stylesheet a value-of a for-each Instructs the XSLT processor to process the information for each instance of the specified pattern. a sort Follows the syntax: a text <xsl:for-each select="pattern"> [action to be performed] </xsl:for-each> Ver. 1.0 Session 5 Slide 15 of 33
  • 16. Extensible Markup Language Formatting Data Using XSLT (Contd.) XSLT provides the following elements to select and format data: a stylesheet a value-of a for-each a sort Sorts data based on the values assigned to elements a text and attributes. Follows the syntax: <xsl:sort select="expression" order="ascending | descending" case-order="upper-first | lower-first“ data-type="text | number | qname"/> Ver. 1.0 Session 5 Slide 16 of 33
  • 17. Extensible Markup Language Formatting Data Using XSLT (Contd.) XSLT provides the following elements to select and format data: a stylesheet a value-of a for-each a sort a text Generates constant text in the output and displays labels. Follows the syntax: <xsl:text> Text to be displayed as label </xsl:text> Ver. 1.0 Session 5 Slide 17 of 33
  • 18. Extensible Markup Language Formatting Data Using XSL Formatting Objects XSL Formatting Objects (XSL-FO): Is an XML-based language that formats XML documents into pages, paragraphs, and lists. Provides various objects and properties that define the formatting of XML objects. Provides a basic document structure that contains the formatting objects and properties. Ver. 1.0 Session 5 Slide 18 of 33
  • 19. Extensible Markup Language Formatting Data Using XSL Formatting Objects (Contd.) The following code snippet depicts the structure of an XML document: Is <?xml version="1.0" encoding="ISO-8859-1"?> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master master-name="A4"> <!-- Page template goes here --> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="A4"> <!-- Page content goes here --> </fo:page-sequence> </fo:root> Ver. 1.0 Session 5 Slide 19 of 33
  • 20. Extensible Markup Language Formatting Data Using XSL Formatting Objects (Contd.) The XSL-FO objects provides a logical layout to an XML document. The content of an XML document can be split into pages. These pages are divided into following four areas: a Regions: Are the topmost areas in the page. a Block areas: Are the block level elements. a Line areas: Contain the text within the block areas. a Inline areas: Are part of line areas. Ver. 1.0 Session 5 Slide 20 of 33
  • 21. Extensible Markup Language Formatting Data Using XSL Formatting Objects (Contd.) The XSL-FO properties specifies the type of formatting that can be specified on the XSL-FO objects. Consider the following code-snippet: <fo:simple-page-master master-name="right"> <fo:region-body margin-left="5in" margin-right="2in"/> </fo:simple-page-master> This the namedefines a template with element right. This specifies that the left margin of the template is set to 5 inches. This specifies that the right margin of the template is set to 2 inches. Ver. 1.0 Session 5 Slide 21 of 33
  • 22. Extensible Markup Language Creating XSLT Template Rules A template rule: Describes how an XML element and its contents are converted into a specific format for displaying in the browser. Consists of two parts: a A pattern that identifies an XML element in an XML document. a An action or processing code that details the transformation and rendering of the resulting element. XSLT uses two main elements for creating template rules: a template a apply-templates Ver. 1.0 Session 5 Slide 22 of 33
  • 23. Extensible Markup Language Creating XSLT Template Rules (Contd.) A template rule: Describes how an XML element and its contents are converted into a specific format for displaying in the browser. Consists of two parts: a A pattern that identifies an XML element in an XML document. a An action or processing code that details the transformation and rendering of the resulting element. XSLT uses two main elements for creating template rules: a template Defines a template for the desired a apply-templates output. Follows the syntax: <xsl:template match="pattern"> [action to be taken] </xsl:template> Ver. 1.0 Session 5 Slide 23 of 33
  • 24. Extensible Markup Language Creating XSLT Template Rules (Contd.) A template rule: Describes how an XML element and its contents are converted into a specific format for displaying in the browser. Consists of two parts: a A pattern that identifies an XML element in an XML document. a An action or processing code that details the transformation and rendering of the resulting element. XSLT uses two main elements for creating template rules: a template a apply-templates Instructs the XSLT processor to find an appropriate template and perform the specified tasks on selected elements. Follows the syntax: <xsl:apply‑templates [select="pattern"]> Ver. 1.0 Session 5 Slide 24 of 33
  • 25. Extensible Markup Language Demo: Creating an XSLT Style Sheet to Format Data Problem Statement: CyberShoppe needs to display product details, such as product ID, name, and price per unit. The following figure depicts a sample output. The details about the products should be displayed in red. Ver. 1.0 Session 5 Slide 25 of 33
  • 26. Extensible Markup Language Practice Questions The various departments of a university store data in different formats. The IT department of the university decides to use XML as the data interchange format to transmit the data between the departments. Which of the following would be the best approach to accomplish the task using XML? a. Devise a common information model and enforce its use by all the departments that need to exchange data. b. Implement a conversion application that can handle the data received from other departments. Ver. 1.0 Session 5 Slide 26 of 33
  • 27. Extensible Markup Language Practice Questions (Contd.) c. Use an XSLT style sheet to convert the incoming or outgoing XML document into the format used within the departments. d. Modify the XML schema to use the same content model in all departments. Answer: c. Use an XSLT style sheet to convert the incoming or outgoing XML document into the format used within the departments. Ver. 1.0 Session 5 Slide 27 of 33
  • 28. Extensible Markup Language Practice Questions • Which of the following code snippets can be used in an XML document named Test.xml to associate it with a style sheet named Test.css? a. <?xml-stylesheet href="Test.css" type="text/css"?> b. <?xml-stylesheet href="Test.xsl" type="text/css"?> c. <?xmlstylesheet href="Test.css" type="text/xsl"?> d. <xml-stylesheet href="Test.css" type="text/css"/> Answer: a. <?xml-stylesheet href=”Test.css” type=”text/css”?> Ver. 1.0 Session 5 Slide 28 of 33
  • 29. Extensible Markup Language Practice Questions Consider the following statements: Statement A: CSS can be used to reorder, add, delete, or perform other operations on elements. Statement B: CSS uses less memory when compared to XSLT. Which of the following is correct about the preceding statements? a. Statement A is True, and Statement B is False. b. Statement A is False, and Statement B is True. c. Both, Statement A and Statement B, are True. d. Both, Statement A and Statement B, are False. Answer: b. Statement A is False, and Statement B is True. Ver. 1.0 Session 5 Slide 29 of 33
  • 30. Extensible Markup Language Practice Questions Which element must contain one or more when elements? a. xsl:if b. xsl:for-each c. xsl:sort d. xsl:choose Answer: d. xsl:choose Ver. 1.0 Session 5 Slide 30 of 33
  • 31. Extensible Markup Language Practice Questions Consider the following statements: Statement A: XSLT is a superset of the CSS functionality. Statement B: XSLT is an application of XML. Which of the following is correct about the preceding statements? a. Statement A is True, and Statement B is False. b. Statement A is False, and Statement B is True. c. Both, Statement A and Statement B, are True. d. Both, Statement A and Statement B, are False. Answer: c. Both, Statement A and Statement B, are True. Ver. 1.0 Session 5 Slide 31 of 33
  • 32. Extensible Markup Language Summary In this session, you learned that: Rendering is the process of formatting and presenting the data in an XML document in different formats. A style sheet is a document that contains the formatting rules for one or several XML documents. The two types of style sheets that can be used with XML documents are:  CSS  XSL  CSS is used to define the style or appearance of an XML document.  XSL is made up of XSLT and XPath.  XSLT is used to display selective elements or attributes, sort data on one or more elements, and process the data based on conditions. Ver. 1.0 Session 5 Slide 32 of 33
  • 33. Extensible Markup Language Summary (Contd.)  The XSLT processor applies the transformation information contained in the XSLT style sheet and builds a resultant tree structure, which is then rendered to various targets.  XSLT elements, such as template, apply-templates, sort, for-each, and value-of are used to extract and format data.  XSL-FO provides formatting objects to break XML documents into pages, paragraphs, and lists. The associated properties of the formatting objects allow you to format the XML documents.  A template rule describes how an XML element and its contents are converted into a format that can be displayed in the browser. Ver. 1.0 Session 5 Slide 33 of 33

Editor's Notes

  1. Introduce the students to the course by asking them what they know about forensics. Next, ask the students what they know about system forensics and why is it required in organizations dependent on IT. This could be a brief discussion of about 5 minutes. Lead the discussion to the objectives of this chapter.
  2. Introduce the students to the different types of threats that systems face by: Asking the students to give examples of what they think are environmental and human threats. Asking the students to give instances of what they think are malicious and non-malicious threats. Conclude the discussion on the different types of threats by giving additional examples of malicious and non malicious threats.
  3. Introduce the students to the different types of threats that systems face by: Asking the students to give examples of what they think are environmental and human threats. Asking the students to give instances of what they think are malicious and non-malicious threats. Conclude the discussion on the different types of threats by giving additional examples of malicious and non malicious threats.
  4. Introduce the students to the different types of threats that systems face by: Asking the students to give examples of what they think are environmental and human threats. Asking the students to give instances of what they think are malicious and non-malicious threats. Conclude the discussion on the different types of threats by giving additional examples of malicious and non malicious threats.
  5. Introduce the students to the different types of threats that systems face by: Asking the students to give examples of what they think are environmental and human threats. Asking the students to give instances of what they think are malicious and non-malicious threats. Conclude the discussion on the different types of threats by giving additional examples of malicious and non malicious threats.
  6. Hold a two- three minute discussion on the different types of system-related crimes that the students have experienced or heard. At the end of the discussion, give additional examples of system-related crimes.
  7. Hold a two- three minute discussion on the different types of system-related crimes that the students have experienced or heard. At the end of the discussion, give additional examples of system-related crimes.
  8. Hold a two- three minute discussion on the different types of system-related crimes that the students have experienced or heard. At the end of the discussion, give additional examples of system-related crimes.
  9. While explaining the definition of system forensics, ask the students to note the following key words in the definition: Identify Extract Process Analyze Digital and hardware evidence Tell the students that these form an integral aspect of system forensics and would be discussed in detail. Before moving on to the next slide, hold a brief discussion on why is it important for organizations to take the help of system forensics. The discussion should be focused on: The role that system forensics plays in organizations having an IT set up. This discussion will serve as a precursor to the next slide.
  10. While explaining the definition of system forensics, ask the students to note the following key words in the definition: Identify Extract Process Analyze Digital and hardware evidence Tell the students that these form an integral aspect of system forensics and would be discussed in detail. Before moving on to the next slide, hold a brief discussion on why is it important for organizations to take the help of system forensics. The discussion should be focused on: The role that system forensics plays in organizations having an IT set up. This discussion will serve as a precursor to the next slide.
  11. Elaborate on the role that system forensics plays in an organization, based on the discussion in the previous slide and the information given on this slide.
  12. Connect the information given on this slide to the initial discussion held on the different types of system-related crimes.
  13. Connect the information given on this slide to the initial discussion held on the different types of system-related crimes.
  14. Connect the information given on this slide to the initial discussion held on the different types of system-related crimes.
  15. Connect the information given on this slide to the initial discussion held on the different types of system-related crimes.
  16. Connect the information given on this slide to the initial discussion held on the different types of system-related crimes.
  17. Connect the information given on this slide to the initial discussion held on the different types of system-related crimes.
  18. Connect the information given on this slide to the initial discussion held on the different types of system-related crimes.
  19. Connect the information given on this slide to the initial discussion held on the different types of system-related crimes.
  20. Connect the information given on this slide to the initial discussion held on the different types of system-related crimes.
  21. Connect the information given on this slide to the initial discussion held on the different types of system-related crimes.
  22. Connect the information given on this slide to the initial discussion held on the different types of system-related crimes.
  23. Connect the information given on this slide to the initial discussion held on the different types of system-related crimes.
  24. Connect the information given on this slide to the initial discussion held on the different types of system-related crimes.
  25. While explaining the definition of system forensics, ask the students to note the following key words in the definition: Identify Extract Process Analyze Digital and hardware evidence Tell the students that these form an integral aspect of system forensics and would be discussed in detail. Before moving on to the next slide, hold a brief discussion on why is it important for organizations to take the help of system forensics. The discussion should be focused on: The role that system forensics plays in organizations having an IT set up. This discussion will serve as a precursor to the next slide.
  26. Reiterate the concepts taught earlier by asking the given question.
  27. Reiterate the concepts taught earlier by asking the given question.
  28. Reiterate the concepts taught earlier by asking the given question.
  29. Reiterate the concepts taught earlier by asking the given question.
  30. Reiterate the concepts taught earlier by asking the given question.
  31. Reiterate the concepts taught earlier by asking the given question.