In this session, you will learn to:

Slides:



Advertisements
Similar presentations
XML-XSL Introduction SHIJU RAJAN SHIJU RAJAN Outline Brief Overview Brief Overview What is XML? What is XML? Well Formed XML Well Formed XML Tag Name.
Advertisements

XML III. Learning Objectives Formatting XML Documents: Overview Using Cascading Style Sheets to format XML documents Using XSL to format XML documents.
Advanced XSLT. Branching in XSLT XSLT is functional programming –The program evaluates a function –The function transforms one structure into another.
XSL November 4, Unit 6. Default sorting is based on text However, we can also sort on numbers, more successfully than last class We use the data-type.
1 XSLT – eXtensible Stylesheet Language Transformations Modified Slides from Dr. Sagiv.
Introduction to C Programming
 2007 Pearson Education, Inc. All rights reserved Introduction to C Programming.
Introduction to C Programming
September 15, 2003Houssam Haitof1 XSL Transformation Houssam Haitof.
MC 365 – Software Engineering Presented by: John Ristuccia Shawn Posts Ndi Sampson XSLT Introduction BCi.
Manohar – Why XML is Required Problem: We want to save the data and retrieve it further or to transfer over the network. This.
Introduction to XPath Bun Yue Professor, CS/CIS UHCL.
SD2520 Databases using XML and JQuery
Fundamentals of Python: From First Programs Through Data Structures
ECA 228 Internet/Intranet Design I Intro to XSL. ECA 228 Internet/Intranet Design I XSL basics W3C standards for stylesheets – CSS – XSL: Extensible Markup.
Integrating XML with Microsoft SQL Server ©NIITeXtensible Markup Language/Lesson 9/Slide 1 of 31 Objectives In this lesson, you will learn to: * Generate.
CSE3201/CSE4500 XPath. 2 XPath A locator for elements or attributes in an XML document. XPath expression gives direction.
Lecture 6 of Advanced Databases XML Schema, Querying & Transformation Instructor: Mr.Ahmed Al Astal.
XSLT for Data Manipulation By: April Fleming. What We Will Cover The What, Why, When, and How of XSLT What tools you will need to get started A sample.
CSE3201/CSE4500 Information Retrieval Systems
XP New Perspectives on XML Tutorial 6 1 TUTORIAL 6 XSLT Tutorial – Carey ISBN
XP 1 CREATING AN XML DOCUMENT. XP 2 INTRODUCING XML XML stands for Extensible Markup Language. A markup language specifies the structure and content of.
WORKING WITH XSLT AND XPATH
1 XPath XPath became a W3C Recommendation 16. November 1999 XPath is a language for finding information in an XML document XPath is used to navigate through.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 6 XSLT (Based on Møller and Schwartzbach,
Working with the XML Document Object Model ©NIITeXtensible Markup Language/Lesson 7/Slide 1 of 44 Objectives In this lesson, you will learn to: *Identify.
Processing of structured documents Spring 2003, Part 7 Helena Ahonen-Myka.
XQL, OQL and SQL Xia Tang Sixin Qian Shijun Shen Feb 18, 2000.
ECA 228 Internet/Intranet Design I XSLT Example. ECA 228 Internet/Intranet Design I 2 CSS Limitations cannot modify content cannot insert additional text.
CITA 330 Section 6 XSLT. Transforming XML Documents to XHTML Documents XSLT is an XML dialect which is declared under namespace "
XSLT Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Selection Control Structures. Simple Program Design, Fourth Edition Chapter 4 2 Objectives In this chapter you will be able to: Elaborate on the uses.
ACG 6415 XSLT Presenting XML and XBRL. Re-Purpose  The main benefit of XML / XBRL Reusability of Data contained in Instance Document We need a method.
[ Part III of The XML seminar ] Presenter: Xiaogeng Zhao A Introduction of XQL.
Working with XML Schemas ©NIITeXtensible Markup Language/Lesson 3/Slide 1 of 36 Objectives In this lesson, you will learn to: * Declare attributes in an.
XP New Perspectives on XML, 2 nd Edition Tutorial 7 1 TUTORIAL 7 CREATING A COMPUTATIONAL STYLESHEET.
ACG 4401 XSLT Extensible Stylesheet Language for Transformations Presenting XML and XBRL.
Accessing XML Documents Using DOM ©NIITeXtensible Markup Language/Lesson 8/Slide 1 of 23 Objectives In this lesson, you will learn to: * Use XML DOM objects.
XPath --XML Path Language Motivation of XPath Data Model and Data Types Node Types Location Steps Functions XPath 2.0 Additional Functionality and its.
ACG 4401 XSLT Extensible Stylesheet Language for Transformations Presenting XML and XBRL.
An Introduction to Programming with C++ Sixth Edition Chapter 5 The Selection Structure.
Displaying Data with XSLT ©NIITeXtensible Markup Language/Lesson 6/Slide 1 of 45 Objectives In this lesson, you will learn to: * Perform conditional formatting.
5 Copyright © 2004, Oracle. All rights reserved. Navigating XML Documents by Using XPath.
XML Schema – XSLT Week 8 Web site:
Rendering XML Documents ©NIITeXtensible Markup Language/Lesson 5/Slide 1 of 46 Objectives In this session, you will learn to: * Define rendering * Identify.
CH 15 XSL Transformations 1. Objective What is XSL? Overview of XSL transformations Understanding XSL templates Computing the value of a node with xsl:value-of.
Creating Groups of Elements and Attributes in an XML Schema ©NIITeXtensible Markup Language/Lesson 4/Slide 1 of 28 Objectives In this lesson, you will.
In this session, you will learn to:
XSLT: The XML transformation language
Writing Simple Queries in Access
XML: Extensible Markup Language
Document Type Definition
Excel IF Function.
In this session, you will learn to:
Chapter 2 - Introduction to C Programming
The Selection Structure
Chapter 2 - Introduction to C Programming
ACG 4401 XSLT Extensible Stylesheet Language for Transformations
Chapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming
Applying eXtensible Style Sheets (XSL)
Rationale Data interchange is essential to carry out business transactions. However, organizations store data in disparate formats, which makes the process.
In this session, you will learn to:
XML WITH CSS.
Chapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming
Chapter 3: Selection Structures: Making Decisions
Chapter 2 - Introduction to C Programming
Chapter 3: Selection Structures: Making Decisions
Introduction to C Programming
Presentation transcript:

In this session, you will learn to: Objectives In this session, you will learn to: Perform conditional formatting Use XPath pattern Present data in different formats 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.

Performing Conditional Formatting Conditional formatting refers to the formatting of data based on a specific condition. The two elements used for conditional formatting are: if choose 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.

Performing Conditional Formatting (Contd.) Conditional formatting refers to the formatting of data based on a specific condition. The two elements used for conditional formatting are: if choose Provides an if-then construct. Follows the syntax: <xsl:if test="condition"> [actions to be performed if the condition is true] </xsl:if> 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.

Performing Conditional Formatting (Contd.) Conditional formatting refers to the formatting of data based on a specified condition. The two elements used for conditional formatting are: if choose Enables you to choose from two or more possible courses of action by testing multiple conditions. Follows the syntax: <xsl:choose> [action to be taken] </xsl:when> : <xsl:otherwise> </xsl:otherwise> </xsl:choose> 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.

Greater than or equal to Identifying Comparison and Boolean Operators Used with the if and choose elements to narrow down the formatting criteria. The following table lists various comparison and Boolean operators. Operator Meaning Example PRICE[. = 20] PRODUCTNAME[. = ‘Mini Bus’] Equal to = PRICE[. != 20] PRODUCTNAME[. != ‘Barbie Doll’] != Not equal to 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. < Less than PRICE[. < 20] PRICE[. > 20] > Greater than <= Less than or equal to PRICE[. <= 20] Greater than or equal to PRICE[. >= 20] >= and PRICE[. &gt 20 and . < 30] Logical AND or Logical OR PRICE[. = 20 or . = 45] PRICE[not(. = 30)] not Negation operator

Using XPath XPath: Is used to search and retrieve information from an XML file. Treats an XML document as a tree of interrelated branches and nodes, as shown in the following figure. PRODUCTDATA PRODUCT 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. PRODID=“P001” CATEGORY =“TOY” PRODUCTNAME DESCRIPTION PRICE QOH Mini Bus This toy is for children aged 4 and above 75 54

Describing XPath Expressions XPath expressions can be used to retrieve data based on specific conditions. XPath expressions identify the nodes in an XML document based on their names and values. The following table lists the operators that can be used to create XPath expressions. Operator/Special Character Example Description / /PRODUCTDATA Selects the immediate child elements of PRODUCTDATA. If this operator occurs at the start of the pattern, it indicates that the child elements should be selected from the root node. // //PRODUCTNAME Searches for the specified element at any node level. . .PRODUCTNAME Indicates the current context. .. ../PRODUCTNAME Selects the PRODUCTNAME element, which exists within the parent of the current element. * Selects all elements. 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.

Describing XPath Expressions (Contd.) Operator/Special Character Example Description @ @PRODUCTID Used as a prefix for the attribute. @* Selects all attributes. : Separates the namespace prefix from the element or attribute name. ( ) (PRICE*QUANTITY) Used to group operations. [ ] [@PRODUCTID='P001'] Applies a filter pattern. + num1 + num2 Returns the sum of two numbers. - num1 - num2 Returns the difference of two numbers. * num1 * num2 Returns the product of two numbers. div num1 div num2 Returns the quotient of two numbers. mod num1 mod num2 Returns the modulus, that is, the remainder of integer division. 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.

Describing XPath Functions XPath functions can be used to calculate and present data as a report. The various categories of functions in XPath are: string: Used to perform string operations. node-set: Used to manipulate node-sets or to return information about them. Boolean: Used to evaluate an expression and return true or false. numeric: Used for numeric calculations. 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.

Demo: Using XPath Patterns in XSLT Style Sheets Problem Statement: The executive at CyberShoppe needs to display the product-wise order report. The product and order data is stored in an XML document. This data includes product details, such as product ID, name, and price per unit. For each product, the details about all the orders placed against that product are also stored in the document. The order details include the order number, shipping address, total quantity ordered and the order value. The total sales value for each product also needs to be displayed. 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.

Demo: Using XPath Patterns in XSLT Style Sheets (Contd.) Problem Statement (Contd.): The following figure illustrates the data display format. 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.

Demo: Using XPath Patterns in XSLT Style Sheets (Contd.) Problem Statement (Contd.): The following figure displays the structure of the corresponding XML document. SUMMARY PRODUCT ORDER 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. SHIPPING ADDRESS QUANTITY

Demo: Creating a Style Sheet Using an XSLT Editor Problem Statement: The employee information of an organization is stored in the file employee.xml. The data stored in this file is as follows: <?xml version="1.0"?> <EMPDETAILS> <EMP EMPID="E001"> <ENAME>Karen</ENAME> <DESG>MANAGER</DESG> <DEPT>SALES</DEPT> <SALARY>250</SALARY> </EMP> <EMP EMPID="E002"> <ENAME>George</ENAME> <DESG>Executive</DESG> <DEPT>ACCOUNTS</DEPT> <SALARY>300</SALARY> 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.

Demo: Creating a Style Sheet Using an XSLT Editor (Contd.) Problem Statement (Contd.): </EMP> <EMP EMPID="E003"> <ENAME>Steve</ENAME> <DESG>Manager</DESG> <DEPT>FINANCE</DEPT> <SALARY>320</SALARY> <EMP EMPID="E004"> <ENAME>Ricky</ENAME> <DESG>Clerk</DESG> <DEPT>SALES</DEPT> <SALARY>150</SALARY> 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.

Demo: Creating a Style Sheet Using an XSLT Editor (Contd.) Problem Statement (Contd.): <EMP EMPID="E005"> <ENAME>Richard</ENAME> <DESG>Divisional Manager</DESG> <DEPT>MARKETING</DEPT> <SALARY>375</SALARY> </EMP> </EMPDETAILS> Display the name, designation, and department of the employees earning higher than $250 in green and the rest in red. You need to display the details as a bulleted list. Create the style sheet using an XSLT editor. 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.

Displaying Data in a Tabular Format The features of HTML and XSLT can be combined to format the data from an XML document for appropriate display. The HTML code can be embedded in an XSLT document to display the data. 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.

Displaying Data in a Tabular Format (Contd.) The following table lists the HTML elements that are required to display data in a tabular format. HTML Tag Description TABLE Acts as a container for all other tags used to specify the appearance of data in a table. It has attributes, such as border, background color, cellpadding, cellspacing, and width that enable you to specify the appearance of the table. THEAD Used to specify headings for a table. TBODY Used as a parent for the TR and TD elements. TR Used to represent a row in a table. This tag acts as a container for the TH and TD elements. TH Used to add column headings. TD Used to specify the data to be displayed in columns. 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.

Demo: Displaying Data in a Table Problem Statement: The details about the books that are available for sale at CyberShoppe are stored in an XML document. The book details, such as book ID, title, rate, author first name, and author last name should be displayed in a table. The first and last names of the author should be displayed in a single column, AUTHOR(S). If a book has multiple authors, their names should be displayed as comma‑separated values. The following figure shows a sample output. 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.

Exercises Problem Statement: The list of products sold at CyberShoppe needs to be displayed. These products need to be categorized based on their prices, with products priced higher than $50 displayed in red and the rest in green. The product name, description, price, and quantity on hand of each product should be displayed, as shown in the following figure. The product.xml file will be provided to you. 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.

Practice Questions You need to display the details of all employees whose salary is equal to $1200. The salary of an employee is represented using the SALARY element in an XML document. Which of the following statements will you use to filter the employee data based on the specified criterion? a. <xsl:if test=“SALARY[. = 1200]”> b. <xsl:if test=“SALARY[. = ‘1200’] /> c. <xsl:if select=“SALARY[. = ‘1200’]”> d. <xsl:if match=“SALARY[. = 1200]”> Reiterate the concepts taught earlier by asking the given question. Answer: a. <xsl:if test=”SALARY[. = 1200]”>

What will the following XPath expression return? Practice Questions What will the following XPath expression return? starts-with(“Hello World”, “world”) a. 0 b. True c. False d. 7 Reiterate the concepts taught earlier by asking the given question. Answer: c. False

What will the following XPath expression return? sum(100 + 200) Practice Questions What will the following XPath expression return? sum(100 + 200) a. 300 b. NaN c. The expression will result in an error. d. Null Reiterate the concepts taught earlier by asking the given question. Answer: c. The expression will result in an error.

Consider the following statements: Practice Questions Consider the following statements: Statement A: XPath treats an XML document as a tree of inter-related branches and nodes. Statement B: A node can be of any type, such as an element, attribute, processing instruction (PI), comment, text, or namespace. 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. Reiterate the concepts taught earlier by asking the given question. Answer: c. Both, Statement A and Statement B, are True.

Practice Questions Which one of the following statements will you use to display the value of an attribute named partno? a. <xsl:text select=“partno”/> b. <xsl:value-of select= “@partno” /> c. <xsl:value-of select= “partno” /> d. <xsl:value-of select= “@partno” > Reiterate the concepts taught earlier by asking the given question. Answer: b. <xsl:value-of select= “@partno” />

In this session, you learned that: Summary In this session, you learned that: The if and choose elements in XSLT allow you to format data based on a condition. The if element provides a simple if-then construct. It has a single test attribute, which specifies the criteria for performing an action. The choose element selects one element from a number of possible alternatives. It consists of a number of when elements, followed by an optional otherwise element. The XPath language is used to search and retrieve information from an XML document. The primary purpose of XPath is to address parts of an XML document, and manipulate strings, numbers, and Boolean values.

Summary (Contd.) XPath expressions can match specific patterns, retrieve results, and perform additional operations relative to the context of the returned nodes. XPath provides the following types of functions: string: Used for basic string operations, such as finding the length of a string or changing a string from uppercase to lowercase. node-set: Used to manipulate node sets or return information about node sets. Boolean: Used to return either true or false based on the argument passed to it. numeric: Used to perform calculations on numeric values. The HTML code in an XSLT style sheet is used to display data in different formats. The import element is used to import one XSLT style sheet to another XSLT style sheet.