SlideShare a Scribd company logo
Rendering XML Documents XML http://yht4ever.blogspot.com [email_address] B070066 - NIIT Quang Trung 08/2007
Contents Formatting Data using XSLT Introducing XSL Introducing CSS Define rendering
Define rendering Rendering refers to processing an XML document to present it with the desired formatting.  XML does not focus on formatting. Therefore, a style sheet is required for formatting and rendering XML documents. A style sheet performs the following tasks: Transform an XML document into another structure and render it to a specific target. Describe how to present the transformed information.  Style sheets can be of the following three types: Cascading Style Sheets eXtensible Style Sheets Document Style Semantics and Specification Language (DSSSL)
Introducing CSS Creating CSS The syntax for coding a CSS is: elementname { property1: value;   property2: value; } In the preceding syntax: elementname specifies the name of the element.  property1 and property2 specify the property names. Value specifies the property values for a property name.
Introducing CSS (cont.) Applying CSS The CSS file needs to be associated with the XML document for applying formatting specifications. A CSS can be applied to an XML document using the  Processing Instruction: <?xml:stylesheet type=&quot;text/css&quot; href=&quot;path-name&quot;?> In the above statement: xml:stylesheet instructs the browser that the XML document uses a  stylesheet. type specifies the type of formatting used.  href specifies the name of the CSS file used to format the XML document.
Demo & Exercises Ex1: The employee information is stored in the emp.xml file. Use this file to display the employee details in the following format: Name of the employee: Times New Roman, blue, 20pts Designation: Arial, green, 10pts Department: Arial, green, 10pts Salary: Times New Roman, blue, 20pts Use cascading style sheets to format the  data in the emp.xml file.
Introducing XSL CSS does not support the reorder, sort, and display of elements based on a condition.  For such advanced formatting, XML supports e X tensible  S tylesheet  L anguage (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 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.
Introducing XSL (cont.) Comparing CSS and XSLT The following table draws a comparison between CSS and XSLT: Follows the XML syntax. Does not use XML syntax.  Uses more memory and processor power.  Uses less memory.  Allows access and manipulation of the comments, PI, and attribute values and names within an XML document.  Does not offer access to non-elements, such as attributes, attribute values, and PI.  Can reorder, add, or delete elements.  Cannot reorder, add, delete, or perform operations on elements.  Complex to use.  Simple to use, and suitable for simple documents.  XSLT CSS
Introducing XSL (cont.) 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:
Formatting Data using XSLT Formatting Data using XSLT XSLT provides the following elements to select and format data:  stylesheet value-of for-each sort text The stylesheet element:  Instructs the browser that the document is a style sheet file. Is the root element for all XSLT style sheets. Is written as: <xsl:stylesheet xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; version=&quot;1.0&quot;>
Formatting Data using XSLT (cont.) Formatting Data using XSLT (cont.) The value-of element: Displays the value of the specified element or attribute.   Follows the syntax:  <xsl:value‑of select=&quot;elementname/attributename&quot;/> The for-each element:  Instructs the XSLT processor to process the information for each instance of the specified pattern. Follows the syntax:  <xsl:for-each select=&quot;pattern&quot;>  [action to be performed]  </xsl:for-each>
Formatting Data using XSLT (cont.) Formatting Data using XSLT (cont.) The sort element:  Sorts data based on the values assigned to elements and attributes.  Follows the syntax:  <xsl:sort select=&quot;expression&quot; order=&quot;ascending|descending&quot;  case-order=&quot;upper-first|lower-first“ data-type=&quot;text|number|qname&quot;/>   The text element:  Generates constant text in the output and displays labels.  Follows the syntax: <xsl:text> Text to be displayed  as label </xsl:text>
Formatting Data using XSLT (cont.) 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, pattern and action. The template element: Defines a template for the desired output Follows the syntax:  <xsl:template match=&quot;pattern&quot;>  [action to be taken] </xsl:template>
Formatting Data using XSLT (cont.) Creating XSLT Template Rules (cont.) The apply-template element: Instructs the XSLT processor to find an appropriate template and perform the specified tasks on selected elements.  Follows the syntax: <xsl:apply‑templates [select=&quot;pattern&quot;]>
Formatting Data using XSLT (cont.)
Demo & Exercises To be continued…
Reference XML How to program http://www.w3.org Teach Yourself XML in 21 Days, 3 rd  Edition Learning XML, 2 nd  Edition Andy Clark presentation. XML tutorial http://www.w3schools.com/w3c/
Q&A Feel free to post questions at  http://yht4ever.blogspot.com or email to:  [email_address]  or  [email_address]
http://yht4ever.blogspot.com Thank You !

More Related Content

PPTX
Presentations on web database
PPTX
Client server architecture
PPT
Database structure
PDF
Database System Concepts and Architecture
PPTX
DBMS - Database Management System
PDF
Distributed Systems Naming
PPT
Object Oriented Database Management System
PPT
Lecture 4 mobile database system
Presentations on web database
Client server architecture
Database structure
Database System Concepts and Architecture
DBMS - Database Management System
Distributed Systems Naming
Object Oriented Database Management System
Lecture 4 mobile database system

What's hot (20)

PPTX
Dbms and rdbms ppt
PPTX
Normalization in DBMS
PPTX
Distributed database
PPTX
Distributed DBMS - Unit 5 - Semantic Data Control
PPTX
Mobile dbms
PPT
Database concurrency control &amp; recovery (1)
PPT
02 xml schema
PPTX
Distributed design alternatives
PPTX
Design of Hadoop Distributed File System
PPTX
Rdbms
PPTX
Advantages of DBMS
PPT
1412676jhhhhhhhhhhhhhhhhhhhbnvvnvnvvv2.ppt
PPTX
Software scope
PPTX
Query decomposition in data base
PPTX
Stream oriented communication
PDF
Manchester & Differential Manchester encoding scheme
PPTX
Temporal database
PPT
Types dbms
PPTX
Chapter-4 Enhanced ER Model
PPT
File organization 1
Dbms and rdbms ppt
Normalization in DBMS
Distributed database
Distributed DBMS - Unit 5 - Semantic Data Control
Mobile dbms
Database concurrency control &amp; recovery (1)
02 xml schema
Distributed design alternatives
Design of Hadoop Distributed File System
Rdbms
Advantages of DBMS
1412676jhhhhhhhhhhhhhhhhhhhbnvvnvnvvv2.ppt
Software scope
Query decomposition in data base
Stream oriented communication
Manchester & Differential Manchester encoding scheme
Temporal database
Types dbms
Chapter-4 Enhanced ER Model
File organization 1
Ad

Similar to Rendering XML Documents (20)

PPT
Rendering XML Document
PPTX
Rendering XML Document
PPT
5 xsl (formatting xml documents)
PPT
XML/XSLT
PPTX
XPATH_XSLT-1.pptx
PPTX
PPT
PPTX
PPTX
Xml part5
PPT
Xml and DTD's
PPTX
Xml transformation language
PPT
Week 12 xml and xsl
DOC
DOC
PPTX
Overview of XSL, XPath and XSL-FO
PPTX
Xml schema
PPTX
Introduction to XSLT
PPT
Rendering XML Document
Rendering XML Document
5 xsl (formatting xml documents)
XML/XSLT
XPATH_XSLT-1.pptx
Xml part5
Xml and DTD's
Xml transformation language
Week 12 xml and xsl
Overview of XSL, XPath and XSL-FO
Xml schema
Introduction to XSLT
Ad

More from yht4ever (11)

PPTX
Applications of SOA and Web Services in Grid Computing
PPT
ERD - Database Design
PPT
Web Page Authoring 1
PPT
Introduction to HTML
PPT
Introduction to HTML
PPT
Document Object Model
PPT
XPath - XML Path Language
PPT
XML Schema
PPT
Document Type Definition
PPT
Introduction to XML
PPT
GUI Programming In Java
Applications of SOA and Web Services in Grid Computing
ERD - Database Design
Web Page Authoring 1
Introduction to HTML
Introduction to HTML
Document Object Model
XPath - XML Path Language
XML Schema
Document Type Definition
Introduction to XML
GUI Programming In Java

Recently uploaded (20)

PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Getting Started with Data Integration: FME Form 101
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Encapsulation theory and applications.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Tartificialntelligence_presentation.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PPT
Teaching material agriculture food technology
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
A Presentation on Artificial Intelligence
PPTX
1. Introduction to Computer Programming.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Getting Started with Data Integration: FME Form 101
Spectral efficient network and resource selection model in 5G networks
Encapsulation theory and applications.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Per capita expenditure prediction using model stacking based on satellite ima...
Tartificialntelligence_presentation.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Group 1 Presentation -Planning and Decision Making .pptx
Machine learning based COVID-19 study performance prediction
Unlocking AI with Model Context Protocol (MCP)
Advanced methodologies resolving dimensionality complications for autism neur...
SOPHOS-XG Firewall Administrator PPT.pptx
Teaching material agriculture food technology
Mobile App Security Testing_ A Comprehensive Guide.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
A Presentation on Artificial Intelligence
1. Introduction to Computer Programming.pptx

Rendering XML Documents

  • 1. Rendering XML Documents XML http://yht4ever.blogspot.com [email_address] B070066 - NIIT Quang Trung 08/2007
  • 2. Contents Formatting Data using XSLT Introducing XSL Introducing CSS Define rendering
  • 3. Define rendering Rendering refers to processing an XML document to present it with the desired formatting. XML does not focus on formatting. Therefore, a style sheet is required for formatting and rendering XML documents. A style sheet performs the following tasks: Transform an XML document into another structure and render it to a specific target. Describe how to present the transformed information. Style sheets can be of the following three types: Cascading Style Sheets eXtensible Style Sheets Document Style Semantics and Specification Language (DSSSL)
  • 4. Introducing CSS Creating CSS The syntax for coding a CSS is: elementname { property1: value; property2: value; } In the preceding syntax: elementname specifies the name of the element. property1 and property2 specify the property names. Value specifies the property values for a property name.
  • 5. Introducing CSS (cont.) Applying CSS The CSS file needs to be associated with the XML document for applying formatting specifications. A CSS can be applied to an XML document using the Processing Instruction: <?xml:stylesheet type=&quot;text/css&quot; href=&quot;path-name&quot;?> In the above statement: xml:stylesheet instructs the browser that the XML document uses a stylesheet. type specifies the type of formatting used. href specifies the name of the CSS file used to format the XML document.
  • 6. Demo & Exercises Ex1: The employee information is stored in the emp.xml file. Use this file to display the employee details in the following format: Name of the employee: Times New Roman, blue, 20pts Designation: Arial, green, 10pts Department: Arial, green, 10pts Salary: Times New Roman, blue, 20pts Use cascading style sheets to format the data in the emp.xml file.
  • 7. Introducing XSL CSS does not support the reorder, sort, and display of elements based on a condition. For such advanced formatting, XML supports e X tensible S tylesheet L anguage (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 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.
  • 8. Introducing XSL (cont.) Comparing CSS and XSLT The following table draws a comparison between CSS and XSLT: Follows the XML syntax. Does not use XML syntax. Uses more memory and processor power. Uses less memory. Allows access and manipulation of the comments, PI, and attribute values and names within an XML document. Does not offer access to non-elements, such as attributes, attribute values, and PI. Can reorder, add, or delete elements. Cannot reorder, add, delete, or perform operations on elements. Complex to use. Simple to use, and suitable for simple documents. XSLT CSS
  • 9. Introducing XSL (cont.) 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:
  • 10. Formatting Data using XSLT Formatting Data using XSLT XSLT provides the following elements to select and format data: stylesheet value-of for-each sort text The stylesheet element: Instructs the browser that the document is a style sheet file. Is the root element for all XSLT style sheets. Is written as: <xsl:stylesheet xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; version=&quot;1.0&quot;>
  • 11. Formatting Data using XSLT (cont.) Formatting Data using XSLT (cont.) The value-of element: Displays the value of the specified element or attribute. Follows the syntax: <xsl:value‑of select=&quot;elementname/attributename&quot;/> The for-each element: Instructs the XSLT processor to process the information for each instance of the specified pattern. Follows the syntax: <xsl:for-each select=&quot;pattern&quot;> [action to be performed] </xsl:for-each>
  • 12. Formatting Data using XSLT (cont.) Formatting Data using XSLT (cont.) The sort element: Sorts data based on the values assigned to elements and attributes. Follows the syntax: <xsl:sort select=&quot;expression&quot; order=&quot;ascending|descending&quot; case-order=&quot;upper-first|lower-first“ data-type=&quot;text|number|qname&quot;/> The text element: Generates constant text in the output and displays labels. Follows the syntax: <xsl:text> Text to be displayed as label </xsl:text>
  • 13. Formatting Data using XSLT (cont.) 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, pattern and action. The template element: Defines a template for the desired output Follows the syntax: <xsl:template match=&quot;pattern&quot;> [action to be taken] </xsl:template>
  • 14. Formatting Data using XSLT (cont.) Creating XSLT Template Rules (cont.) The apply-template element: Instructs the XSLT processor to find an appropriate template and perform the specified tasks on selected elements. Follows the syntax: <xsl:apply‑templates [select=&quot;pattern&quot;]>
  • 15. Formatting Data using XSLT (cont.)
  • 16. Demo & Exercises To be continued…
  • 17. Reference XML How to program http://www.w3.org Teach Yourself XML in 21 Days, 3 rd Edition Learning XML, 2 nd Edition Andy Clark presentation. XML tutorial http://www.w3schools.com/w3c/
  • 18. Q&A Feel free to post questions at http://yht4ever.blogspot.com or email to: [email_address] or [email_address]