The document discusses XSL (Extensible Stylesheet Language), which is used to style XML documents. Some key points:
- XSL is to XML what CSS is to HTML - it controls how XML documents are displayed.
- XSL has three main parts: XSLT for transforming XML, XPath for navigating XML, and XSL-FO for formatting XML.
- XSLT uses XSLT stylesheets to define transformation rules that are applied to XML documents to generate output like XML, HTML or text.
- Advantages of XSLT include being programming language independent and allowing output to be altered by modifying the XSL stylesheet without changing code.
Service Oriented Architecture- UNIT 2- XSLRoselin Mary S
The document discusses XSL (Extensible Stylesheet Language), which is used to style XML documents. It provides an overview of XSLT (XSL Transformations), XPath, and XSL-FO. It then gives more details on XSLT, explaining how XSLT stylesheets are used to define transformation rules that are applied to XML documents to generate formatted output. Key advantages of XSLT are that transformations are written separately from code, allowing for quick output changes. An example is provided of using XSLT to transform an XML document of student data into an HTML table for display.
XSLT is used to transform XML documents into other formats like HTML. It uses an XML document and an XSL stylesheet to perform the transformation. The XSL stylesheet contains templates that are applied to the XML data to output a new formatted document. Common XSL elements include xsl:value-of to output node values, xsl:for-each for loops, and xsl:apply-templates to apply templates to child nodes. XSLT provides powerful tools for transforming XML but requires careful debugging due to its complexity.
XSLT is used to transform XML documents into other XML documents or HTML. It uses XPath to navigate XML documents. Templates are used to define transformation rules that are applied when nodes are matched. Common elements used in XSLT include value-of to extract node values, for-each for loops, apply-templates to apply templates to child nodes, and copy to duplicate nodes in the output. Conditional logic can be added using elements like if, choose, when and otherwise.
XSLT is used to transform XML documents into other formats. It uses XSLT style sheets, which contain rules that are applied by an XSLT processor to the XML input. Some key capabilities of XSLT include converting XML to HTML, sorting and filtering data, and using conditional logic. Template rules define how to retrieve element values from the XML and output them. Loops, conditional statements, and multiple sorting allow complex transformations of the XML data.
This document provides an overview of XML Schema Definition (XSD). It discusses that XSD is used to describe and validate the structure and vocabulary of an XML document. It then provides an example of a simple XSD code and explains some of its key features, such as being extensible, supporting data types and namespaces. It also outlines the basic syntax of an XSD, including the required <schema> root element and optional attributes like targetNamespace. Finally, it demonstrates how to reference an external XSD from an XML document using schemaLocation.
XSLT (eXtensible Stylesheet Language Transformations) is a language for transforming XML documents into other XML documents or HTML. It uses XPath to navigate XML documents and allows adding, removing, rearranging, and sorting elements in the output document. Some key points:
- XSLT transforms an XML source tree into an XML result tree
- It uses templates and applies templates to elements to transform the document
- Common elements include <xsl:template>, <xsl:value-of>, <xsl:for-each>, <xsl:if>, <xsl:choose>, and <xsl:apply-templates>
- XSLT is supported by browsers through built-in or third
The document discusses XSLT (Extensible Stylesheet Language Transformations), which is used to transform XML documents into other formats like HTML, PDF, etc. It explains some key XSLT elements and concepts:
1. The <template> element matches XML elements and applies styles.
2. The <value-of> element inserts node values from the XML.
3. The <for-each> element loops through multiple occurrences of an element.
It also covers selecting attributes with XPath, using conditional elements like <if> and <choose>, and predicates to filter nodes. XSLT allows XML data to be transformed and presented in different formats.
This document provides an introduction to XSLT by defining key terms like XML, XML Namespaces, HTML, XHTML, XPath, and describing what XSLT is and how it transforms XML documents into other formats like HTML. It explains some of the core components of XSLT including using XPath to select nodes in an XML document and templates defined using xsl:template that transform matched parts of the source XML.
Service Oriented Architecture- UNIT 2- XSLRoselin Mary S
The document discusses XSL (Extensible Stylesheet Language), which is used to style XML documents. It provides an overview of XSLT (XSL Transformations), XPath, and XSL-FO. It then gives more details on XSLT, explaining how XSLT stylesheets are used to define transformation rules that are applied to XML documents to generate formatted output. Key advantages of XSLT are that transformations are written separately from code, allowing for quick output changes. An example is provided of using XSLT to transform an XML document of student data into an HTML table for display.
XSLT is used to transform XML documents into other formats like HTML. It uses an XML document and an XSL stylesheet to perform the transformation. The XSL stylesheet contains templates that are applied to the XML data to output a new formatted document. Common XSL elements include xsl:value-of to output node values, xsl:for-each for loops, and xsl:apply-templates to apply templates to child nodes. XSLT provides powerful tools for transforming XML but requires careful debugging due to its complexity.
XSLT is used to transform XML documents into other XML documents or HTML. It uses XPath to navigate XML documents. Templates are used to define transformation rules that are applied when nodes are matched. Common elements used in XSLT include value-of to extract node values, for-each for loops, apply-templates to apply templates to child nodes, and copy to duplicate nodes in the output. Conditional logic can be added using elements like if, choose, when and otherwise.
XSLT is used to transform XML documents into other formats. It uses XSLT style sheets, which contain rules that are applied by an XSLT processor to the XML input. Some key capabilities of XSLT include converting XML to HTML, sorting and filtering data, and using conditional logic. Template rules define how to retrieve element values from the XML and output them. Loops, conditional statements, and multiple sorting allow complex transformations of the XML data.
This document provides an overview of XML Schema Definition (XSD). It discusses that XSD is used to describe and validate the structure and vocabulary of an XML document. It then provides an example of a simple XSD code and explains some of its key features, such as being extensible, supporting data types and namespaces. It also outlines the basic syntax of an XSD, including the required <schema> root element and optional attributes like targetNamespace. Finally, it demonstrates how to reference an external XSD from an XML document using schemaLocation.
XSLT (eXtensible Stylesheet Language Transformations) is a language for transforming XML documents into other XML documents or HTML. It uses XPath to navigate XML documents and allows adding, removing, rearranging, and sorting elements in the output document. Some key points:
- XSLT transforms an XML source tree into an XML result tree
- It uses templates and applies templates to elements to transform the document
- Common elements include <xsl:template>, <xsl:value-of>, <xsl:for-each>, <xsl:if>, <xsl:choose>, and <xsl:apply-templates>
- XSLT is supported by browsers through built-in or third
The document discusses XSLT (Extensible Stylesheet Language Transformations), which is used to transform XML documents into other formats like HTML, PDF, etc. It explains some key XSLT elements and concepts:
1. The <template> element matches XML elements and applies styles.
2. The <value-of> element inserts node values from the XML.
3. The <for-each> element loops through multiple occurrences of an element.
It also covers selecting attributes with XPath, using conditional elements like <if> and <choose>, and predicates to filter nodes. XSLT allows XML data to be transformed and presented in different formats.
This document provides an introduction to XSLT by defining key terms like XML, XML Namespaces, HTML, XHTML, XPath, and describing what XSLT is and how it transforms XML documents into other formats like HTML. It explains some of the core components of XSLT including using XPath to select nodes in an XML document and templates defined using xsl:template that transform matched parts of the source XML.
XSD (XML Schema Definition) is used to describe and validate the structure and content of XML data. It provides more powerful capabilities than DTD. XML Schemas support data types, restrictions on elements and attributes, and namespaces. With XML Schema, groups can agree on standards for exchanging data and documents can be verified. XML Schemas use XML syntax, so they can be edited, parsed, and manipulated like any other XML document. The purpose of an XML Schema is to define the legal building blocks of an XML document, such as elements, attributes, and their structure.
The document discusses XML schema (XSD) including defining elements and attributes, simple and complex types, namespaces, restrictions and facets. It provides examples of defining elements and attributes of different data types, setting default and fixed values, and adding restrictions on values, content, format and whitespace.
XML schemas provide a more powerful way to define the structure and content of XML documents compared to DTDs. Schemas support data types, namespaces, and more complex definitions of elements and attributes. The main elements used in schemas are:
1. <xs:schema> which defines the root element and namespace for a schema.
2. <xs:element> and <xs:attribute> which define elements and attributes with attributes like name, type, and occurrence.
3. <xs:complexType> which defines complex element types with child elements, attributes, and mixed content.
Schemas allow precise specification of XML documents' structure through elements, attributes, data types and occurrence to enable validation of
The document discusses SQL concepts including data manipulation language (DML), data definition language (DDL), data control language (DCL), and data types. DML statements like SELECT, INSERT, UPDATE, DELETE are used to query and manipulate data. DDL statements create, modify and delete database objects. DCL controls user access and privileges. Data types specify the type of data stored and supported types include numeric, character, date/time etc. Examples of SQL queries, operators and DML statements like INSERT, UPDATE, ALTER, DROP are also provided.
An XML schema defines the structure and elements of an XML document. It is an XML-based alternative to DTDs that allows defining element types, attributes, data types, defaults and restrictions. Schemas support namespaces, data types, extensibility and are written in XML, allowing the use of XML tools. Complex elements can contain child elements, text or both.
XML Schema provides a way to formally define and validate the structure and content of XML documents. It allows defining elements, attributes, and data types, as well as restrictions like length, pattern, and value ranges. DTD is more limited and cannot validate data types. XML Schema is written in XML syntax, uses XML namespaces, and provides stronger typing capabilities compared to DTD. It allows defining simple and complex element types, attributes, and restrictions to precisely describe the expected structure and values within XML documents.
SQL is a special-purpose programming language designed to manage data in relational database management systems (RDBMS). It allows users to define, manipulate, and control access to data in databases. SQL statements are divided into two main categories: DDL (Data Definition Language) statements are used to define database objects like tables, while DML (Data Manipulation Language) statements are used to query and manipulate data like SELECT, INSERT, UPDATE, DELETE. SQL was developed in the 1970s by IBM researchers Donald D. Chamberlin and Raymond F. Boyce and was initially called SEQUEL.
XML schema defines the structure and elements of an XML document. It defines elements, attributes, and data types. Elements are the building blocks and can be simple types like strings or integers, complex types that can contain child elements, or global types that can be reused. Attributes provide additional information for elements. An XML schema uses tags like <xs:element> and <xs:complexType> to define the document structure.
SXML: S-expression eXtensible Markup Languageelliando dias
This document discusses SXML, which stands for S-expression eXtensible Markup Language. SXML represents XML documents as S-expressions to allow them to be easily manipulated and modified using Lisp. This provides advantages over other XML manipulation methods like PHP, JavaScript, and XSLT by making operations like adding attributes simpler and safer. The document outlines features of SXML like quasiquotes for executable snippets and transforming capabilities. It also discusses the implementation of SXML as a library for the Bigloo Scheme programming language.
The document describes what an XML Schema is and its key components and purposes. It defines an XML Schema as describing the structure of an XML document, and that it can define elements, attributes, element sequence and number, data types, and default values. It compares XML Schemas to DTDs, noting schemas are more powerful and support namespaces and data types. The document provides examples of using XML Schema to define simple and complex elements, attributes, and restrictions.
The document discusses XML schemas and defines various XML schema components. It explains concepts like namespaces, element and attribute qualification, content models using sequence, choice, all and group, simple types with facets, and lists and unions. It provides examples of how to define elements and attributes with XML schemas by setting restrictions and patterns on data types.
Structured Query Language (SQL) is a standard language used to create, retrieve, and manage data in relational databases. SQL allows users to define tables, manipulate data within those tables through insert, update, delete statements, and retrieve data through select statements. SQL has different components including DDL for defining database structure, DML for manipulating data, DCL for controlling access, and TCL for managing transactions.
The document introduces SQL statements and joins. It discusses the main SQL statement types - DDL, DML, DCL, DQL - and provides examples of commands like CREATE, DROP, ALTER, INSERT, UPDATE, DELETE, GRANT, REVOKE, SELECT. It also explains different types of joins in SQL - INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN - and provides the syntax for each.
The document discusses schemas and their purpose in specifying the structure and constraints of an XML document. It provides examples of things that cannot be done with DTDs but can be done with schemas, such as constraining text values. The document outlines the components of a schema, including elements, attributes, and data types. It provides an example of defining a schema in IE5 and the steps involved, including declaring element types, specifying content models, and using data types.
This document provides an overview of XML DTD and Schema. It defines key terms like well-formed, valid, DTD and describes how a DTD is used to define element types and attributes. It also explains different DTD rules like EMPTY, ANY, #PCDATA. The document then covers XML Schema elements, data types, and how to declare elements, attributes and complex/simple types in a schema.
Native XML processing in C++ (BoostCon'11)Sumant Tambe
XML programming has emerged as a powerful data processing paradigm with its own rules for abstracting, partitioning, programming styles, and idioms. Seasoned XML programmers expect, and their productivity depends on the availability of languages and tools that allow usage of the patterns and practices native to the domain of XML programming. The object-oriented community, however, prefers XML data binding tools over dedicated XML languages because these tools automatically generate a statically-typed, vocabulary-specific object model from a given XML schema. Unfortunately, these tools often sidestep the expectations of seasoned XML programmers because of the difficulties in synthesizing abstractions of XML programming using purely object-oriented principles. This talk demonstrates how this prevailing gap can be significantly narrowed by a novel application of multi-paradigm programming capabilities of C++. In particular, how generic programming, meta-programming, generative programming, strategic programming, and operator overloading supported by C++ together enable native and typed XML programming.
XSL is a language used to describe how to display XML files in a browser. It can convert XML files into other formats like HTML. The most common use of XSL is to convert XML files into HTML that can be displayed in browsers. Key elements in XSL include xsl:template to match nodes, xsl:value-of to extract node values, xsl:for-each to iterate over nodes, and xsl:copy to copy nodes from the XML file to the output. An example shows using an XSL stylesheet to transform an XML file about a fitness center member into an HTML web page that displays the member's name, favorite color, and phone numbers.
Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...Allison Jai O'Dell
This document summarizes key concepts about XML, XPath, XSLT, and XQuery. It provides examples of using XPath to select nodes from an XML document, using XSLT to transform XML documents to other formats like HTML, and using XQuery to query XML data. XPath is used to navigate XML, XSLT transforms XML documents, and XQuery combines XPath and FLWOR expressions to process, join, and return XML data. Examples demonstrate selecting nodes, transforming XML to XML and HTML, and the basic structure of XQuery with FLWOR expressions.
This document provides an overview and introduction to XML (eXtensible Markup Language). It discusses the basic rules of XML, parsing XML, XML namespaces, XML schemas, XSLT transformations, and examples of where XML is applied such as web design, web services, mobile web, and content authoring.
XSD (XML Schema Definition) is used to describe and validate the structure and content of XML data. It provides more powerful capabilities than DTD. XML Schemas support data types, restrictions on elements and attributes, and namespaces. With XML Schema, groups can agree on standards for exchanging data and documents can be verified. XML Schemas use XML syntax, so they can be edited, parsed, and manipulated like any other XML document. The purpose of an XML Schema is to define the legal building blocks of an XML document, such as elements, attributes, and their structure.
The document discusses XML schema (XSD) including defining elements and attributes, simple and complex types, namespaces, restrictions and facets. It provides examples of defining elements and attributes of different data types, setting default and fixed values, and adding restrictions on values, content, format and whitespace.
XML schemas provide a more powerful way to define the structure and content of XML documents compared to DTDs. Schemas support data types, namespaces, and more complex definitions of elements and attributes. The main elements used in schemas are:
1. <xs:schema> which defines the root element and namespace for a schema.
2. <xs:element> and <xs:attribute> which define elements and attributes with attributes like name, type, and occurrence.
3. <xs:complexType> which defines complex element types with child elements, attributes, and mixed content.
Schemas allow precise specification of XML documents' structure through elements, attributes, data types and occurrence to enable validation of
The document discusses SQL concepts including data manipulation language (DML), data definition language (DDL), data control language (DCL), and data types. DML statements like SELECT, INSERT, UPDATE, DELETE are used to query and manipulate data. DDL statements create, modify and delete database objects. DCL controls user access and privileges. Data types specify the type of data stored and supported types include numeric, character, date/time etc. Examples of SQL queries, operators and DML statements like INSERT, UPDATE, ALTER, DROP are also provided.
An XML schema defines the structure and elements of an XML document. It is an XML-based alternative to DTDs that allows defining element types, attributes, data types, defaults and restrictions. Schemas support namespaces, data types, extensibility and are written in XML, allowing the use of XML tools. Complex elements can contain child elements, text or both.
XML Schema provides a way to formally define and validate the structure and content of XML documents. It allows defining elements, attributes, and data types, as well as restrictions like length, pattern, and value ranges. DTD is more limited and cannot validate data types. XML Schema is written in XML syntax, uses XML namespaces, and provides stronger typing capabilities compared to DTD. It allows defining simple and complex element types, attributes, and restrictions to precisely describe the expected structure and values within XML documents.
SQL is a special-purpose programming language designed to manage data in relational database management systems (RDBMS). It allows users to define, manipulate, and control access to data in databases. SQL statements are divided into two main categories: DDL (Data Definition Language) statements are used to define database objects like tables, while DML (Data Manipulation Language) statements are used to query and manipulate data like SELECT, INSERT, UPDATE, DELETE. SQL was developed in the 1970s by IBM researchers Donald D. Chamberlin and Raymond F. Boyce and was initially called SEQUEL.
XML schema defines the structure and elements of an XML document. It defines elements, attributes, and data types. Elements are the building blocks and can be simple types like strings or integers, complex types that can contain child elements, or global types that can be reused. Attributes provide additional information for elements. An XML schema uses tags like <xs:element> and <xs:complexType> to define the document structure.
SXML: S-expression eXtensible Markup Languageelliando dias
This document discusses SXML, which stands for S-expression eXtensible Markup Language. SXML represents XML documents as S-expressions to allow them to be easily manipulated and modified using Lisp. This provides advantages over other XML manipulation methods like PHP, JavaScript, and XSLT by making operations like adding attributes simpler and safer. The document outlines features of SXML like quasiquotes for executable snippets and transforming capabilities. It also discusses the implementation of SXML as a library for the Bigloo Scheme programming language.
The document describes what an XML Schema is and its key components and purposes. It defines an XML Schema as describing the structure of an XML document, and that it can define elements, attributes, element sequence and number, data types, and default values. It compares XML Schemas to DTDs, noting schemas are more powerful and support namespaces and data types. The document provides examples of using XML Schema to define simple and complex elements, attributes, and restrictions.
The document discusses XML schemas and defines various XML schema components. It explains concepts like namespaces, element and attribute qualification, content models using sequence, choice, all and group, simple types with facets, and lists and unions. It provides examples of how to define elements and attributes with XML schemas by setting restrictions and patterns on data types.
Structured Query Language (SQL) is a standard language used to create, retrieve, and manage data in relational databases. SQL allows users to define tables, manipulate data within those tables through insert, update, delete statements, and retrieve data through select statements. SQL has different components including DDL for defining database structure, DML for manipulating data, DCL for controlling access, and TCL for managing transactions.
The document introduces SQL statements and joins. It discusses the main SQL statement types - DDL, DML, DCL, DQL - and provides examples of commands like CREATE, DROP, ALTER, INSERT, UPDATE, DELETE, GRANT, REVOKE, SELECT. It also explains different types of joins in SQL - INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN - and provides the syntax for each.
The document discusses schemas and their purpose in specifying the structure and constraints of an XML document. It provides examples of things that cannot be done with DTDs but can be done with schemas, such as constraining text values. The document outlines the components of a schema, including elements, attributes, and data types. It provides an example of defining a schema in IE5 and the steps involved, including declaring element types, specifying content models, and using data types.
This document provides an overview of XML DTD and Schema. It defines key terms like well-formed, valid, DTD and describes how a DTD is used to define element types and attributes. It also explains different DTD rules like EMPTY, ANY, #PCDATA. The document then covers XML Schema elements, data types, and how to declare elements, attributes and complex/simple types in a schema.
Native XML processing in C++ (BoostCon'11)Sumant Tambe
XML programming has emerged as a powerful data processing paradigm with its own rules for abstracting, partitioning, programming styles, and idioms. Seasoned XML programmers expect, and their productivity depends on the availability of languages and tools that allow usage of the patterns and practices native to the domain of XML programming. The object-oriented community, however, prefers XML data binding tools over dedicated XML languages because these tools automatically generate a statically-typed, vocabulary-specific object model from a given XML schema. Unfortunately, these tools often sidestep the expectations of seasoned XML programmers because of the difficulties in synthesizing abstractions of XML programming using purely object-oriented principles. This talk demonstrates how this prevailing gap can be significantly narrowed by a novel application of multi-paradigm programming capabilities of C++. In particular, how generic programming, meta-programming, generative programming, strategic programming, and operator overloading supported by C++ together enable native and typed XML programming.
XSL is a language used to describe how to display XML files in a browser. It can convert XML files into other formats like HTML. The most common use of XSL is to convert XML files into HTML that can be displayed in browsers. Key elements in XSL include xsl:template to match nodes, xsl:value-of to extract node values, xsl:for-each to iterate over nodes, and xsl:copy to copy nodes from the XML file to the output. An example shows using an XSL stylesheet to transform an XML file about a fitness center member into an HTML web page that displays the member's name, favorite color, and phone numbers.
Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...Allison Jai O'Dell
This document summarizes key concepts about XML, XPath, XSLT, and XQuery. It provides examples of using XPath to select nodes from an XML document, using XSLT to transform XML documents to other formats like HTML, and using XQuery to query XML data. XPath is used to navigate XML, XSLT transforms XML documents, and XQuery combines XPath and FLWOR expressions to process, join, and return XML data. Examples demonstrate selecting nodes, transforming XML to XML and HTML, and the basic structure of XQuery with FLWOR expressions.
This document provides an overview and introduction to XML (eXtensible Markup Language). It discusses the basic rules of XML, parsing XML, XML namespaces, XML schemas, XSLT transformations, and examples of where XML is applied such as web design, web services, mobile web, and content authoring.
Slides of my presentations at ApacheCon EU 07, see http://www.eu.apachecon.com/program/talk/84, and at the Cocoon GetTogether 2007, see http://www.cocoongt.org/
Slides for the workshop session on “XML and XSLT” (session B4) at the IWMW 2001 event held at Queen's University Belfast on 25-27 June 2001.
See http://www.ukoln.ac.uk/web-focus/events/workshops/webmaster-2001/sessions.html#b4
XML stands for Extensible Markup Language and was designed to store and transport data in a human- and machine-readable format. XSLT (Extensible Stylesheet Language Transformations) is used to transform XML documents into other document formats, usually XHTML. XSLT uses an XML document containing the data and an XSL stylesheet containing commands to transform the data and insert it into an output framework. An XML schema describes the structure of an XML document like a DTD. It ensures XML documents are both well-formed through valid syntax and valid through validation against the schema. XML schemas allow complex element and attribute declarations including data types and use requirements.
"The Ebook Developer's Toolbox" by Sanders Kleinfeld (O’Reilly Media) for ebookcraft 2016, presented by BookNet Canada and eBOUND Canada - March 31, 2016
In Pursuit of the Grand Unified Templatehannonhill
This document discusses using XSLT to create conditional page formatting and restructuring of content from a single template. It provides examples of how to determine layout rules, output alternative page elements, and expose additional metadata at the page level. Key points covered include checking for content, assigning layouts, applying layout rules to different page areas, and extracting metadata values as variables.
This document provides an overview of Extensible Stylesheet Language Transformations (XSLT). It discusses how XSLT is used to transform XML documents and style their presentation. Key points include:
- XSLT uses XPath expressions to select nodes or node-sets from an XML document and then outputs the results as a new XML document that describes how to display the data.
- XSLT transformations involve parsing the source XML into a tree structure, transforming the data from the input structure to the desired output structure, and then serializing the result tree.
- XSLT stylesheets use elements like <xsl:template> and <xsl:apply-templates> to define template rules for matching
This document provides an overview of XML, including its basic structure and components. XML documents use elements to structure and tag content. Elements must be properly nested within a single root element and can have attributes. The relationships between these elements form a tree structure. XML documents also support comments, processing instructions, and character encoding. CSS and XSLT can be used to display and transform XML for web users. While databases are better for structured data, XML is well suited for loosely structured or large records.
Java Course 12: XML & XSL, Web & ServletsAnton Keks
This document provides an overview of XML, XSL, and Java technologies for working with XML. It discusses XML syntax and structure, validation, namespaces, DTDs and XML Schema for validation. It also covers XPath for querying XML, XSLT for transforming XML, and Java APIs including JAXP, JDOM, DOM4J, and JAXB for processing XML using Java.
This document discusses XML stylesheet language (XSL) which has two languages - XSL Transformation Language (XSLT) to convert XML documents to other formats, and XSL Formatting Objects Language (XSL-FO) to describe presentation of XML documents. It provides an example using an XML book document and XSL stylesheet to display book details by applying XSLT template rules and retrieving element values using <xsl:value-of> tags.
"Getting Started with XSLT" presentation slidesRussell Ward
The document provides an introduction to XSLT (eXtensible Stylesheet Language Transformations) and demonstrates how to transform an XML file into HTML using XSLT stylesheets. It defines the basic components needed for XSLT (XML file, XSLT stylesheet, processing engine), describes the processing flow, and provides examples of increasingly complex XSLT stylesheets that transform a sample XML file into HTML output.
The document discusses XML document structure and XML schema. It provides information on the key components of an XML document including the XML declaration, document type declaration, element data, attribute data, and character data. It then describes XML schema in detail, explaining that it defines the structure of an XML document. Key aspects of XML schema covered include elements, attributes, simple vs complex types, and restrictions.
This document provides an overview of transforming XML documents with XSLT (eXtensible Stylesheet Language Transformations). It describes what XSLT is, its goals and capabilities, basic XSLT elements and syntax, and how XSLT works by matching templates to XML elements and applying transformations. Key points include that XSLT is an XML language for transforming XML documents into other formats like HTML, XML, plain text; it uses XPath for navigation and templates matched with XML elements; and common elements are <xsl:template>, <xsl:value-of>, <xsl:for-each> and <xsl:apply-templates>.
XML Schema is used to describe and validate the structure and content of XML data. It defines elements, attributes, and data types for XML documents. An XML Schema describes the structure of an XML document similar to a database schema describing data structure. XML Schemas are written in XML and can be extended to support additions and data types. XML Schemas allow independent groups to agree on standards for exchanging data and verifying data contents.
XSL stands for Extensible Stylesheet Language and is used to transform and format XML documents. The main components of XSL are:
XSLT is used to transform XML documents into other XML or HTML documents. It uses XPath to navigate XML elements and supports elements like <xsl:template>, <xsl:value-of>, <xsl:for-each> and <xsl:if>.
XSL-FO is used for formatting XML documents.
Some key XSLT elements are <xsl:template> which defines templates, <xsl:value-of> to extract node values, <xsl:for-each> for looping, <xsl:sort> and <xsl:if> for conditional
Integrative Programming and Technology Chapter 4- Dr. J. VijiPriyaVijiPriya Jeyamani
The document discusses XSL, XSLT, XPath and how they are used together. XSL is an XML-based stylesheet language used to describe how XML documents should be displayed. It consists of three parts: XSLT for transforming XML documents, XPath for navigating XML documents, and XSL-FO for formatting XML documents. XSLT uses XPath to find information in XML documents and transform them into other XML documents. XPath allows navigation through elements and attributes in XML documents using path expressions. All major browsers support XML, XSLT and XPath.
The document discusses XML transformation using XSLT. It begins with an introduction to XSL and XSLT. XSLT is a language for transforming XML documents into other formats. The document then provides an example of using an XSL stylesheet to transform an XML document containing bird data into HTML. It loops through each bird element and outputs the name and size. Another XSL file is shown using conditional logic to output different text depending on the bird name.
Similar to Service Oriented Architecture - Unit II (20)
The document discusses software engineering and the software development life cycle. It describes the typical phases of software engineering including requirements specification, architectural design, detailed design, coding and testing, integration, and maintenance. It also discusses verification and validation activities to ensure the software meets specifications and requirements. Prototyping techniques are discussed as part of an iterative design process to overcome issues with incomplete requirements gathering.
Unit1 17-08-2020 HUMAN COMPUTER INTERACTIONRoselin Mary S
This document provides an overview of human-computer interaction (HCI). It discusses why HCI is important, defining HCI and describing the user, computer, and interaction. It then covers the different input and output channels humans use, including the senses of vision, hearing, touch, and motor control. For each input channel, it describes the anatomical structures and processing involved. The document emphasizes that understanding human factors is crucial for designing intuitive and effective interfaces.
This document discusses different classes of defects that can occur during software development and testing. It identifies four main defect classes:
1. Requirement/specification defects that occur early in ambiguous, incomplete, or contradictory requirements documents.
2. Design defects that happen when system components or their interactions are incorrectly designed, such as flaws in algorithms, control logic, or interface descriptions.
3. Coding defects resulting from errors implementing code, including issues with algorithms, control structures, data types, interfaces, and documentation.
4. Testing defects in test harnesses, cases, and procedures that could lead to incorrect or incomplete testing. The classes of defects guide strategies for test planning and design.
The document discusses 11 principles of software testing. It explains that a fault in code does not always produce a failure, as a failure only occurs when the software is unable to perform its required functions, while a fault is simply an error or defect in the code. It also discusses the roles of testers and how testing should be integrated into the software development lifecycle.
Service Oriented Architecture -Unit II - Modeling databases in xml Roselin Mary S
Modeling databases in xml
Steps:
1. Review the database schema.
2. Construct the desired XML document.
3. Define a schema for the XML document.
4. Create the JAXB binding schema.
5. Generate the JAXB classes based on the schema.
6. Develop a Data Access Object (DAO).
7. Develop a servlet for HTTP access.
Service Oriented Architecture - Unit II - Sax Roselin Mary S
The document provides information about SAX (Simple API for XML), which is an event-based parser for XML documents. Unlike DOM parsers, SAX parsers do not create a parse tree in memory. SAX parsers read XML documents sequentially from top to bottom and generate events to notify applications as elements, attributes, and text are encountered. The document discusses why SAX is used, supported languages, versions of SAX, popular SAX APIs, and how SAX parsing works through callback methods in a ContentHandler interface.
XML is a markup language that focuses on data rather than presentation. It allows users to define their own elements and tags to structure information in a way that is understandable by both humans and machines. XML documents contain elements that describe the document's structure and content. Elements are delimited by tags like <tagname>element content</tagname> and may have attributes that provide additional information. The XML specification was developed by the World Wide Web Consortium to allow structured data to be shared across different systems.
Introduction- e - waste – definition - sources of e-waste– hazardous substances in e-waste - effects of e-waste on environment and human health- need for e-waste management– e-waste handling rules - waste minimization techniques for managing e-waste – recycling of e-waste - disposal treatment methods of e- waste – mechanism of extraction of precious metal from leaching solution-global Scenario of E-waste – E-waste in India- case studies.
International Conference on NLP, Artificial Intelligence, Machine Learning an...gerogepatton
International Conference on NLP, Artificial Intelligence, Machine Learning and Applications (NLAIM 2024) offers a premier global platform for exchanging insights and findings in the theory, methodology, and applications of NLP, Artificial Intelligence, Machine Learning, and their applications. The conference seeks substantial contributions across all key domains of NLP, Artificial Intelligence, Machine Learning, and their practical applications, aiming to foster both theoretical advancements and real-world implementations. With a focus on facilitating collaboration between researchers and practitioners from academia and industry, the conference serves as a nexus for sharing the latest developments in the field.
Literature Review Basics and Understanding Reference Management.pptxDr Ramhari Poudyal
Three-day training on academic research focuses on analytical tools at United Technical College, supported by the University Grant Commission, Nepal. 24-26 May 2024
A review on techniques and modelling methodologies used for checking electrom...nooriasukmaningtyas
The proper function of the integrated circuit (IC) in an inhibiting electromagnetic environment has always been a serious concern throughout the decades of revolution in the world of electronics, from disjunct devices to today’s integrated circuit technology, where billions of transistors are combined on a single chip. The automotive industry and smart vehicles in particular, are confronting design issues such as being prone to electromagnetic interference (EMI). Electronic control devices calculate incorrect outputs because of EMI and sensors give misleading values which can prove fatal in case of automotives. In this paper, the authors have non exhaustively tried to review research work concerned with the investigation of EMI in ICs and prediction of this EMI using various modelling methodologies and measurement setups.
Advanced control scheme of doubly fed induction generator for wind turbine us...IJECEIAES
This paper describes a speed control device for generating electrical energy on an electricity network based on the doubly fed induction generator (DFIG) used for wind power conversion systems. At first, a double-fed induction generator model was constructed. A control law is formulated to govern the flow of energy between the stator of a DFIG and the energy network using three types of controllers: proportional integral (PI), sliding mode controller (SMC) and second order sliding mode controller (SOSMC). Their different results in terms of power reference tracking, reaction to unexpected speed fluctuations, sensitivity to perturbations, and resilience against machine parameter alterations are compared. MATLAB/Simulink was used to conduct the simulations for the preceding study. Multiple simulations have shown very satisfying results, and the investigations demonstrate the efficacy and power-enhancing capabilities of the suggested control system.
We have compiled the most important slides from each speaker's presentation. This year’s compilation, available for free, captures the key insights and contributions shared during the DfMAy 2024 conference.
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTjpsjournal1
The rivalry between prominent international actors for dominance over Central Asia's hydrocarbon
reserves and the ancient silk trade route, along with China's diplomatic endeavours in the area, has been
referred to as the "New Great Game." This research centres on the power struggle, considering
geopolitical, geostrategic, and geoeconomic variables. Topics including trade, political hegemony, oil
politics, and conventional and nontraditional security are all explored and explained by the researcher.
Using Mackinder's Heartland, Spykman Rimland, and Hegemonic Stability theories, examines China's role
in Central Asia. This study adheres to the empirical epistemological method and has taken care of
objectivity. This study analyze primary and secondary research documents critically to elaborate role of
china’s geo economic outreach in central Asian countries and its future prospect. China is thriving in trade,
pipeline politics, and winning states, according to this study, thanks to important instruments like the
Shanghai Cooperation Organisation and the Belt and Road Economic Initiative. According to this study,
China is seeing significant success in commerce, pipeline politics, and gaining influence on other
governments. This success may be attributed to the effective utilisation of key tools such as the Shanghai
Cooperation Organisation and the Belt and Road Economic Initiative.
6th International Conference on Machine Learning & Applications (CMLA 2024)ClaraZara1
6th International Conference on Machine Learning & Applications (CMLA 2024) will provide an excellent international forum for sharing knowledge and results in theory, methodology and applications of on Machine Learning & Applications.
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsVictor Morales
K8sGPT is a tool that analyzes and diagnoses Kubernetes clusters. This presentation was used to share the requirements and dependencies to deploy K8sGPT in a local environment.
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELgerogepatton
As digital technology becomes more deeply embedded in power systems, protecting the communication
networks of Smart Grids (SG) has emerged as a critical concern. Distributed Network Protocol 3 (DNP3)
represents a multi-tiered application layer protocol extensively utilized in Supervisory Control and Data
Acquisition (SCADA)-based smart grids to facilitate real-time data gathering and control functionalities.
Robust Intrusion Detection Systems (IDS) are necessary for early threat detection and mitigation because
of the interconnection of these networks, which makes them vulnerable to a variety of cyberattacks. To
solve this issue, this paper develops a hybrid Deep Learning (DL) model specifically designed for intrusion
detection in smart grids. The proposed approach is a combination of the Convolutional Neural Network
(CNN) and the Long-Short-Term Memory algorithms (LSTM). We employed a recent intrusion detection
dataset (DNP3), which focuses on unauthorized commands and Denial of Service (DoS) cyberattacks, to
train and test our model. The results of our experiments show that our CNN-LSTM method is much better
at finding smart grid intrusions than other deep learning algorithms used for classification. In addition,
our proposed approach improves accuracy, precision, recall, and F1 score, achieving a high detection
accuracy rate of 99.50%.
2. • XSL stands for EXtensible Stylesheet Language. It is similar to XML
as CSS is to HTML.
Need for XSL
• In case of HTML document, tags are predefined such as table, div,
and span; and the browser knows how to add style to them and
display those using CSS styles.
• But in case of XML documents, tags are not predefined. In order to
understand and style an XML document, World Wide Web
Consortium (W3C) developed XSL which can act as XML based
Stylesheet Language.
• An XSL document specifies how a browser should render an XML
document.
• Following are the main parts of XSL −
– XSLT − used to transform XML document into various other types of
document.
– XPath − used to navigate XML document.
– XSL-FO − used to format XML document.
3. What is XSLT
• XSLT, Extensible Stylesheet Language Transformations, provides the ability
to transform XML data from one format to another automatically.
How XSLT Works
• An XSLT stylesheet is used to define the transformation rules to be applied
on the target XML document.
• XSLT stylesheet is written in XML format. XSLT Processor takes the XSLT
stylesheet and applies the transformation rules on the target XML
document and then it generates a formatted document in the form of
XML, HTML, or text format.
• This formatted document is then utilized by XSLT formatter to generate
the actual output which is to be displayed to the end-user.
Advantages
• Independent of programming. Transformations are written in a separate
xsl file which is again an XML document.
• Output can be altered by simply modifying the transformations in xsl file.
No need to change any code. So Web designers can edit the stylesheet
and can see the change in the output quickly.
4.
5. students.xml
<?xml version = "1.0"?>
<class>
<student rollno = "393">
<firstname>Dinkar</firstname>
<lastname>Kad</lastname>
<nickname>Dinkar</nickname>
<marks>85</marks>
</student>
<student rollno = "493">
<firstname>Vaneet</firstname>
<lastname>Gupta</lastname>
<nickname>Vinni</nickname>
<marks>95</marks>
</student>
<student rollno = "593">
<firstname>Jasvir</firstname>
<lastname>Singh</lastname>
<nickname>Jazz</nickname>
<marks>90</marks>
</student>
</class>
We need to define an XSLT style sheet document for the above XML document to
meet the following criteria −
•Page should have a title Students.
•age should have a table of student details.
•Columns should have following headers: Roll No, First Name, Last
Name, Nick Name, Marks
6. Step 1: Create XSLT document
Create an XSLT document to meet the above requirements, name it as students.xsl and save it in the same location
where students.xml lies.
students.xsl
<?xml version = "1.0" encoding = "UTF-8"?>
<!-- xsl stylesheet declaration with xsl namespace:
Namespace tells the xlst processor about which
element is to be processed and which is used for output purpose only
-->
<xsl:stylesheet version = "1.0“ xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
<!-- xsl template declaration:
template tells the xlst processor about the section of xml
document which is to be formatted. It takes an XPath expression.
In our case, it is matching document root element and will
tell processor to process the entire document with this template.
-->
<xsl:template match = "/">
<!-- HTML tags
Used for formatting purpose. Processor will skip them and browser
will simply render them.
-->
<html>
<body>
<h2>Students</h2>
<table border = "1">
<tr bgcolor = "#9acd32">
<th>Roll No</th>
<th>First Name</th>
7. <!-- for-each processing instruction
Looks for each element matching the XPath expression
-->
<xsl:for-each select="class/student">
<tr>
<!-- value-of processing instruction
process the value of the element matching the XPath expression
-->
<td><xsl:value-of select = "@rollno"/></td>
<td><xsl:value-of select = "firstname"/></td>
<td><xsl:value-of select = "lastname"/></td>
<td><xsl:value-of select = "nickname"/></td>
<td><xsl:value-of select = "marks"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
8. Step 2: Link the XSLT Document to the XML Document
Update student.xml document with the following xml-stylesheet tag. Set href value to students.xsl
<?xml version = "1.0"?>
<?xml-stylesheet type = "text/xsl" href = "students.xsl"?>
<class>
...
</class>
9. Step 3: View the XML Document in Internet Explorer
students.xml
<?xml version = "1.0"?>
<?xml-stylesheet type = "text/xsl" href = "students.xsl"?>
<class>
<student rollno = "393">
<firstname>Dinkar</firstname>
<lastname>Kad</lastname>
<nickname>Dinkar</nickname>
<marks>85</marks>
</student>
<student rollno = "493">
<firstname>Vaneet</firstname>
<lastname>Gupta</lastname>
<nickname>Vinni</nickname>
<marks>95</marks>
</student>
<student rollno = "593">
<firstname>Jasvir</firstname>
<lastname>Singh</lastname>
<nickname>Jazz</nickname>
<marks>90</marks>
</student>
</class>
11. XSLT <template>
Name & Description
1
name
Name of the element on which template is to be applied.
2
match
Pattern which signifies the element(s) on which template is to be applied.
3
priority
Priority number of a template. Matching template with low priority is not considered in from in front of high priority
template.
4
mode
Allows element to be processed multiple times to produce a different result each time.
<xsl:template> defines a way to reuse templates in order to generate the desired output for nodes
of a particular type/context.
Declaration
Following is the syntax declaration of <xsl:template> element.
<xsl:template
name = Qname
match = Pattern
priority = number
mode = QName >
</xsl:template>
Attributes
12. Number of occurrences Unlimited
Parent elements xsl:stylesheet, xsl:transform
Child elements
xsl:apply-imports,xsl:apply-templates,xsl:attribute, xsl:call-template, xsl:choose,
xsl:comment, xsl:copy, xsl:copy-of, xsl:element, xsl:fallback, xsl:for-each, xsl:if,
xsl:message, xsl:number, xsl:param, xsl:processing-instruction, xsl:text, xsl:value-
of, xsl:variable, output elements
Elements
students_imports.xsl
<?xml version = "1.0" encoding = "UTF-8"?>
<xsl:stylesheet version = "1.0"
xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
<xsl:template match = "/">
<html>
<body>
<h2>Students</h2>
<table border = "1">
<tr bgcolor = "#9acd32">
<th>Roll No</th>
<th>First Name</th>
<th>Last Name</th>
<th>Nick Name</th>
<th>Marks</th>
</tr>
14. XSLT <value-of>
Sr.No Name & Description
1
Select
XPath Expression to be evaluated in current context.
2
disable-outputescaping
Default-"no". If "yes", output text will not escape xml characters from text.
<xsl:value-of> tag puts the value of the selected node as per XPath expression, as text.
Declaration
Following is the syntax declaration of <xsl:value-of> element.
<xsl:value-of
select = Expression
disable-output-escaping = "yes" | "no" >
</xsl:value-of>
Attributes
Number of Occurrences Unlimited
Parent elements xsl:attribute, xsl:comment, xsl:copy, xsl:element, xsl:fallback, xsl:for-each, xsl:if,
xsl:message, xsl:otherwise, xsl:param, xsl:processing instruction, xsl:template,
xsl:variable, xsl:when, xsl:with-param, output elements
Child elements None
Elements
16. XSLT <sort>
Sr.No Name & Description
1
select
Sorting key of the node.
2
lang
Language alphabet used to determine sort order.
3
data-type
Data type of the text.
4
order
Sorting order. Default is "ascending".
5
case-order
<xsl:sort> tag specifies a sort criteria on the nodes.
Declaration
Following is the syntax declaration of <xsl:sort> element.
<xsl:sort
select = string-expression
lang = { nmtoken }
data-type = { "text" | "number" | QName }
order = { "ascending" | "descending" }
case-order = { "upper-first" | "lower-first" } >
</xsl:sort>
Attributes
17. Number of occurrences Unlimited
Parent elements xsl:apply-templates, xsl:for-each
Child elements None
Elements
19. XSLT <if>
Sr.No Name & Description
1
test
The condition in the xml data to test.
Number of Occurrences Unlimited
Parent elements
xsl:attribute, xsl:comment, xsl:copy, xsl:element, xsl:fallback, xsl:for-each, xsl:if,
xsl:message, xsl:otherwise, xsl:param, xsl:processing-instruction, xsl:template,
xsl:variable, xsl:when, xsl:with-param, output elements
Child elements
xsl:apply-templates, xsl:attribute, xsl:call-template, xsl:choose, xsl:comment, xsl:copy,
xsl:copy-of, xsl:element, xsl:for-each, xsl:if, xsl:processing-instruction, xsl:text,
xsl:value-of, xsl:variable, output elements
<xsl:if> tag specifies a conditional test against the content of nodes.
Declaration
Following is the syntax declaration of <xsl:if> element.
<xsl:if
test = boolean-expression >
</xsl:if>
Attributes
Elements
22. Client-side XSLT processing
• Client-side XSLT processing commonly occurs in a Web browser.
• The Web browser includes an XSLT processor and retrieves the XML
document and XSL style sheet
• The client-side technique offloads the XSLT processing to the client
machine. This minimizes the workload on the Web server.
• However, the Web browser must provide XSLT support.
• E.g: Netscape Communicator 6 , Microsoft Internet Explorer 6
support the XSLT 1.0 specification
23. • For client-side processing, the XML document
requires a special processing instruction to
reference the XSL style sheet.
• The processing instruction is <?xml-
stylesheet>
– it has two attributes: type and href.
• The type attribute specifies the content type of the
document to be retrieved (in this case, text/xsl).
• The href attribute is a URL reference to the style sheet.
The href attribute supports absolute and relative URL
references.
27. • Server-side XSLT processing occurs on the Web server or application server.
• A serverside process such as an Active Server Page (ASP), JavaServer Page
(JSP), or Java servlet will retrieve the XML document and XSL style sheet and
pass them to an XSLT processor.
• The output of the XSLT processor is sent to the client Web browser for
presentation.
• The output is generally a markup language, such as HTML, that is understood
by the client browser.
server-side XSLT processing
28. • An advantage of the server-side technique is browser
independence. This technique supports the older browser versions
and makes the application more robust and versatile.
• Also, by utilizing the server-side technique, the application can
support a diverse collection of clients.
• The application can detect the user-agent, such as a WAP-enabled
mobile phone, and send back a document containing a Wireless
Markup Language (WML) tag.
• The WAP-enabled phone can render the content using the built-in
WML mini-browser.
29. • A number of server-side technologies are available, including Common
Gateway Interface (CGI), ColdFusion, Hypertext Processor (PHP), and so
on.
• Microsoft’s Active Server Pages (ASP) and Sun Microsystems’ JavaServer
Pages (JSP).
ASP: Server-Side XSLT Processing
Required components:
– Microsoft IIS Web Server 5.0. This version of IIS is included with Microsoft
Windows 2000 Professional. We can also use IIS 4.0 or Personal Web Server
(PWS); But, we have to install the Windows NT Option Pack 4.
– Microsoft XML Parser 3.0 If we have IE 6 installed on our server machine, then
Microsoft XML Parser 3.0 is included. The MS XML Parser 3.0 is also available
as a separate download from http://msdn.microsoft.com.
• we have two options for publishing the source code on the IIS server:
– Copy the students.xml and students.xsl files in to c:Inetpubwwwroot.
– Set up a virtual directory that points to the xml file location
30. <%@ Language=VBScript %>
<%
set xml = Server.CreateObject(“Microsoft.XMLDOM”)
xml.load(Server.MapPath(“students.xml”))
set xsl = Server.CreateObject(“Microsoft.XMLDOM”)
xsl.load(Server.MapPath(“students.xsl”))
Response.Write(xml.transformNode(xsl))
%>
Students.asp
A Web browser rendering HTML
31. JSP: Server-Side XSLT Processing
• Sun Microsystems provides a server-side technology that is
very similar to ASP. The server-side scripting is
accomplished in Java.
Required components:
– Sun Microsystems’ Software Development Kit (SDK) 1.3 (or
higher). The SDK is available at Sun’s Web site,
http://java.sun.com/j2se. Follow the installation instructions
provided with the SDK.
– Apache Tomcat Server 4. Apache Tomcat 4 is the official
reference implementation for JSP 1.2 and Java Servlets 2.3.
– If the application server already supports JSP 1.1 or higher,
there is no requirement to install Tomcat. Apache Tomcat 4 is
available from the Apache Web site,
http://jakarta.apache.org/tomcat. Follow the
– installation instructions provided with the Tomcat server.
32. • Once Tomcat 4 is installed, add a new Web
application that points to the source code
directory. This is done by editing the file
<tomcat_install_dir>confserver.xml
• Move to the section where the <Context>
elements are listed and then add the following
entry:
<Context path=”/myapp”
docBase=”c://documents/mypgm/serverpgm”
debug=”0”
reloadable=”true” />
33. • Restart the Tomcat server to pick up the new configuration. By
default, the Tomcat server is listening on port 8080.
• we can access files for the myapp Web application using the
URL http://localhost:8080/myapp/students.jsp.
• A JSP custom tag is a special tag that is created by a developer.
• When the JSP server encounters the custom tag, it executes
the handler code associated with the tag.
• JSP custom tags are conceptually similar to ASP server objects.
• However, the custom action is represented in the JSP page as a
custom tag instead of scripting code.
• The Apache <jakarta:apply> tag provides the XSLT processing.
35. • The first line in this example informs the JSP server to use the tag
library that is identified by the URI
http://jakarta.apache.org/taglibs/xsl-1.0. This URI is defined in the
Web application’s deployment description.
– The URI is actually mapped to the file jakarta-xsl.tld, located in the
directory c://documents/mypgm/serverpgm/WEBINF.
– The file jakarta-xsl.tld is the Tag Library Descriptor (TLD). The TLD file
provides a description of the custom tags available in the class library.
It also provides a mapping between the custom tag name and the tag
handler class.
– The tag handler class is located in the directory
c://documents/mypgm/serverpgmWEB-INFlib.
• The next line of code is the actual <jakarta:apply> tag. This tag has
two attributes—
– one defines the XML input source and the other defines the XSL style
sheet.
• The results of the XSLT process are returned to the Web browser.
To test this example, make sure the Tomcat server is running. In a
Web browser, access the JSP with the URL
http://localhost:8080/myapp/students.jsp.
36. XSL for Business-to-Business (B2B)
Communication
• XSLT can also be used in for B2B communication—the
process of exchanging data between two different
companies.
• Developers can leverage XML to describe the data in a
vendor-independent fashion. In the ideal case, both
companies will agree upon a standard vocabulary for
describing the data using a DTD or schema.
• The vocabulary is composed of the XML element names used
in the XML document.
• However, in certain cases one of the companies might like to
use a different vocabulary. This is where XSL enters the
picture.
37. Scenario
• The computer training company maintains a database for
the students that have attended its courses. The training
company has developed an XML application that produces
the list of students for a given class.
• The management team at software development company
would like to retrieve this list from the training company’s
XML application.
• However, once the data is retrieved, software
development company would like to store the data in a
different XML format using its own XML element names.
38. • The XML application at the training company is accessible using the
HTTP protocol.
• The first step is to request the XML document from the training
company.
• In step 2, the XML document is retrieved.
• In step 3, the document is transformed using the supplied XSLT style
sheet.
• Finally, the desired output document is produced in step 4.
Training
company
Software
development
company
41. • Therefore, a mechanism is needed to convert an XML
document to another XML format.
• XSLT offers a solution to this problem. An XSL style sheet
can be developed to convert the <trainingclass> document
to the <employeelist> document.
• This approach will not require any changes by the training
company. The training company can continue to publish
XML documents for its training classes.
• The development team can develop an XSL style sheet that
contains the transformation rules.
• Once the style sheet is developed, the XML document and
style sheet can be passed to the XSLT processor, which will
generate the desired XML document for <employeelist>.
42. • The training company describes the date for the class using the elements
<start_date> and <end_date>, as shown here:
<start_date>24 Sep 2001</start_date>
<end_date>28 Sep 2001</end_date>
• S/W development company stores the date as a single element with two attributes
for the start and end:
<course_date start=”24 Sep 2001” end=”28 Sep 2001” />
• In this case, <xsl:attribute> can be used to create attributes for <course_date>:
<course_date>
<xsl:attribute name=”start”>
<xsl:value-of select=”start_date”/>
</xsl:attribute>
<xsl:attribute name=”end”>
<xsl:value-of select=”end_date”/>
</xsl:attribute>
</course_date>
The <xsl:attribute> element creates attributes for the parent element. In this example,
the parent element is course_date. This transformation will result in the following
code:
<course_date start=”24 Sep 2001” end=”28 Sep 2001” />
43. <?xml version=”1.0”?>
<xsl:stylesheet xmlns:xsl=”http://www.w3.org/1999/XSL/Transform” version=”1.0”>
<xsl:template match=”/trainingclass”>
<employeelist>
<course_title><xsl:value-of select=”title” /></course_title>
<!-- create attributes for the start and end course dates -->
<course_date>
<xsl:attribute name=”start”>
<xsl:value-of select=”start_date”/>
</xsl:attribute>
<xsl:attribute name=”end”>
<xsl:value-of select=”end_date”/>
</xsl:attribute>
</course_date>
<location><xsl:value-of select=”location” /></location>
train2employee.xsl
44. <!-- Perform a loop for each student in the training class -->
<xsl:for-each select=”student”
<employee>
<name>
<first><xsl:value-of select=”first_name”/></first>
<last><xsl:value-of select=”last_name”/></last>
</name>
<email><xsl:value-of select=”email”/></email>
</employee>
</xsl:for-each>
</employeelist>
</xsl:template>
</xsl:stylesheet>
45. import org.apache.xalan.xslt.*;
/**
* Usage: java XslTester <input XML> <input XSL> <output file>
*/
public class XslTester
{
public static void main(String[] args)
{
try
{
// Verify the correct arguments are passed in
if (args.length != 3)
{
System.out.println(“Usage: java XslTester <input XML> <input XSL> <output file>”);
System.exit(1);
}
System.out.println(“Processing: “ + args[0] + “ and “ + args[1]);
// Step 1: Get a reference to the XSLT Processor
XSLTProcessor myEngine = XSLTProcessorFactory.getProcessor();
// Step 2: Get the XML input document
XSLTInputSource xmlSource = new XSLTInputSource(args[0]);
xslTester.java
46. // Step 3: Get the XSL style sheet
XSLTInputSource xslStylesheet = new XSLTInputSource(args[1]);
// Step 4: Setup the output target
XSLTResultTarget xmlOutput = new XSLTResultTarget(args[2]);
// Step 5: Now process it!
myEngine.process(xmlSource, xslStylesheet, xmlOutput);
System.out.println(“Created => “ + args[2]);
System.out.println(“Done!”);
}
catch (Exception exc) {
exc.printStackTrace();
}
}
}
48. XSL Formatting Objects
• XSL-FO was designed to assist with the printing and displaying of XML
data.
• The main emphasis is on the document layout and structure. This includes
the dimensions of the output document, including page headers, footers,
and margins.
• XSL-FO also allows the developer to define the formatting rules for the
content, such as font, style, color, and positioning.
• XSL-FO is a sophisticated version of Cascading Style Sheets (CSS). In fact,
XSL-FO borrows a lot of the terminology and elements from CSS.
• XSL-FO documents are well-formed XML documents. An XSL-FO formatting
engine processes XSL-FO documents.
• Two techniques for creating XSL-FO documents:
1. simply develop the XSL-FO file with the included data.
2. dynamically create the XSL-FO file using an XSLT translation.
7/29/2019 48Dr.S.Roselin Mary HOD/CSE
50. Basic Document Structure
XSL-FO elements use the following namespace: http://www.w3.org/1999/XSL/Format
<?xml version=”1.0” encoding=”utf-8”?>
<fo:root xmlns:fo=”http://www.w3.org/1999/XSL/Format”>
<!-- layout master set -->
<!-- page masters: size and layout -->
<!-- page sequences and content -->
</fo:root>
• The element <fo:root> is the root element for the XSL-FO document. An XSL-
FO document can contain the following components:
– • Page master describes the page size and layout
– • Page master set refers to the collection of page masters
– • Page sequences defines a series of printed pages. The page sequence
contains the actual content for the document
7/29/2019 50Dr.S.Roselin Mary HOD/CSE
51. • The <fo:simple-page-master> element defines
the layout of a page.
<fo:simple-page-master master-name=”simple”
page-height=”11in”
page-width=”8.5in”
margin-top=”1in”
margin-bottom=”1in”
margin-left=”1.25in”
margin-right=”1.25in” >
</fo:simple-page-master>
7/29/2019 51Dr.S.Roselin Mary HOD/CSE
53. • To set the page height to 210 millimeters, use the
following syntax:
page-height=”210mm”
• The <fo:simple-page-master> element can also be used
to describe an A4 letter (height 210 mm and width 297
mm):
<fo:simple-page-master master-name=”A4-example”
page-height=”210mm”
page-width=”297mm”
margin-top=”0.5in”
margin-bottom=”0.5in”
margin-left=”0.5in”
margin-right=”0.5in” >
</fo:simple-page-master>
7/29/2019 53Dr.S.Roselin Mary HOD/CSE
54. • Each page is divided into five regions. Regions serve as containers for the
document content.
• The region-before and region-after areas are commonly used for page
headers and footers.
• The region-body area is the center of the page and contains the main
content.
• The region-start and region-end sections are commonly used for left and
right sidebars, respectively.
• In the definition of a page master, specify the size of the regions using the
following elements:
• <fo:region-before>
• <fo:region-after>
• <fo:region-body>
• <fo:region-start>
• <fo:region-end>
7/29/2019 54Dr.S.Roselin Mary HOD/CSE
56. <fo:simple-page-master master-name=”simple”
page-height=”11in”
page-width=”8.5in” >
<fo:region-body margin-top=”0.5in”/>
<fo:region-before extent=”0.5in”/>
<fo:region-after extent=”0.5in”/>
</fo:simple-page-master>
• The extent attribute has a different meaning,
depending on the region.
• For <fo:region-end> and <fo:region-start>, the
extent attribute specifies the width.
• For <fo:region-before> and <fo:region-after>, it
specifies the height.
7/29/2019 56Dr.S.Roselin Mary HOD/CSE
57. Page Master Set: <fo:page-master-set>
• A document can be composed of multiple pages, each with its own
dimensions.
• The page master set refers to the collection of page masters.
<fo:layout-master-set>
<fo:simple-page-master master-name=”simple”
page-height=”11in”
page-width=”8.5in”
margin-top=”1in”
margin-bottom=”1in”
margin-left=”1.25in”
margin-right=”1.25in”>
<fo:region-body margin-top=”0.5in”/>
<fo:region-before extent=”3cm”/>
<fo:region-after extent=”1.5cm”/>
</fo:simple-page-master>
</fo:layout-master-set>
7/29/2019 57Dr.S.Roselin Mary HOD/CSE
59. Page Sequences: <fo:page-sequence>
• A page sequence defines a series of printed
pages.
• Each page sequence refers to a page master
for its dimensions.
• The page sequence contains the actual
content for the document.
• The <fo:page-sequence> element contains
– <fo:static-content>
– <fo:flow>
7/29/2019 59Dr.S.Roselin Mary HOD/CSE
60. 1. The <fo:static-content> element is used for page headers
and footers.
E.g:
we can define a header for the company name and page
number, and this information will appear on every page.
2. The <fo:flow> element contains a collection of text blocks.
– The <fo:flow> element is similar to a collection of paragraphs.
– A body of text is defined using the <fo:block> element.
• The <fo:block> element is a child element of <fo:flow>.
• The <fo:block> element contains free-flowing text that will wrap to
the next line in a document if it overflows.
• In this example
7/29/2019 60Dr.S.Roselin Mary HOD/CSE
61. <fo:page-sequence master-name=”simple”>
<fo:flow flow-name=”xsl-region-body”>
<!-- this defines a level 1 heading with orange background -->
<fo:block font-size=”18pt”
font-family=”sans-serif”
line-height=”24pt”
space-after.optimum=”15pt”
background-color=”orange”
color=”white”
text-align=”center”
padding-top=”3pt”>
Ez Books Online
</fo:block>
<!-- Paragraph that contains info about the company -->
<fo:block font-size=”12pt”
font-family=”sans-serif”
line-height=”15pt”
space-after.optimum=”14pt”
text-align=”justify”>
Welcome to Ez Books Online, the world’s smallest online book store.
Our company’s mission is to sell books on Java, Thrillers and Romance.
We have something for everyone...so we think. Feel free to browse our
catalog and if you find a book of interest then send us an e-mail.
Thanks for visiting!
</fo:block>
</fo:flow>
</fo:page-sequence>
7/29/2019 61Dr.S.Roselin Mary HOD/CSE
62. • The <fo:flow> element has to specify a region for its
content.
E.g: the content is placed in the main body region.
• The first <fo:block> element defines a heading with an
orange background.
• The content of each <fo:block> can be customized
using font and line attributes.
• The second <fo:block> element contains information
about the company.
• The text for <fo:block> is free flowing. The text will
automatically wrap.
• Ample space is provided at the end of the paragraph
using the space-after.optimum attribute.
7/29/2019 62Dr.S.Roselin Mary HOD/CSE
64. <!-- this defines a level 1 heading with orange background -->
<fo:block font-size=”18pt”
font-family=”sans-serif”
line-height=”24pt”
space-after.optimum=”15pt”
background-color=”orange”
color=”white”
text-align=”center”
padding-top=”3pt”>
Ez Books Online
</fo:block>
<!-- Paragraph that contains info about the company -->
<fo:block font-size=”12pt”
font-family=”sans-serif”
line-height=”15pt”
space-after.optimum=”14pt”
text-align=”justify”>
Welcome to Ez Books Online, the world’s smallest online book store.
Our company’s mission is to sell books on Java, Thrillers and Romance.
We have something for everyone...so we think. Feel free to browse our
catalog and if you find a book of interest then send us an e-mail.
Thanks for visiting!
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
7/29/2019 64Dr.S.Roselin Mary HOD/CSE
65. Generating a PDF Document
• Convert the XSL-FO document simple.fo to a PDF file.
• we are using the open-source Apache-FOP formatting engine.
• Apache-FOP requires the Java Development Kit from Sun
Microsystems.
• The Adobe Acrobat Reader is required to view the PDF documents.
• The Acrobat Reader is freely available at http://www.adobe.com.
Steps to generate a PDF document from simple.fo:
1. Open an MS-DOS window.
2. Move to the directory where simple.fo is stored
3. Set up the Java classpath by typing setpaths.
4. Execute Apache-FOP by typing fop simple.fo simple.pdf.
5. The Apache-FOP formatter now reads the input file simple.fo and
generates the output file simple.pdf.
6. View the simple.pdf file in Adobe Acrobat Reader.
7/29/2019 65Dr.S.Roselin Mary HOD/CSE
67. Page Headers and Footers
• The <fo:static-content> element defines content that
should appear on every page.
• The <fo:static-content> element is commonly used to set
up page headers and footers.
• The <fo:static-content> element is a component of
<fo:page-sequence>.
• In the following example, we’ll define a page header
that contains the company name and current page
number. We’ll also define a footer that lists the
company’s Web site. This example is also composed of
multiple pages to illustrate the fact that the header and
footer are repeated on each page.
7/29/2019 67Dr.S.Roselin Mary HOD/CSE
68. The header is defined using the following code fragment:
<!-- header -->
<fo:static-content flow-name =”xsl-region-before”>
<fo:block text-align=”end”
font-size=”10pt”
font-family=”serif”
line-height=”14pt” >
Ez Books Catalog - page
<fo:page-number/>
</fo:block>
</fo:static-content>
• The content for the header is placed in xsl-region-before, which is the top
of the page in this example.
• The <fo:block> element uses the text-align attribute to place the text at
the end of the region. This example uses the English language, so the text
is right justified.
• The current page number is determined using the <fo:page-number>
element
Page Header
7/29/2019 68Dr.S.Roselin Mary HOD/CSE
<!-- header -->
<fo:static-content flow-name =”xsl-region-before”>
<fo:block text-align=”end”
font-size=”10pt”
font-family=”serif”
line-height=”14pt” >
Ez Books Catalog - page
<fo:page-number/>
</fo:block>
</fo:static-content>
69. The footer is defined using the following code fragment:
<!-- footer -->
<fo:static-content flow-name=”xsl-region-after”>
<fo:block text-align=”center”
font-size=”10pt”
font-family=”serif”
line-height=”14pt” >
Visit our website http://www.ezbooks.web
</fo:block>
</fo:static-content>
• The footer content is placed at the bottom of the page in xsl-region-
after.
• A message containing the company’s Web site is listed in the footer.
Page Footer
7/29/2019 69Dr.S.Roselin Mary HOD/CSE
<!-- footer -->
<fo:static-content flow-name=”xsl-region-after”>
<fo:block text-align=”center”
font-size=”10pt”
font-family=”serif”
line-height=”14pt” >
Visit our website http://www.ezbooks.web
</fo:block>
</fo:static-content>
70. • New pages are generated using <fo:block break-before=”page”>.
• The static content, header, and footer will also appear on the new
page.
• The following code fragment generates a page break before the
content is rendered.
<!-- insert page break for second page -->
<fo:block break-before=”page”>
A page break is inserted before this block.
Notice we have the headers and footers
in place. This was accomplished with the
fo-static-content elements. We can continue
on...business as usual.
</fo:block>
Page Break
7/29/2019 70Dr.S.Roselin Mary HOD/CSE
<!-- insert page break for second page -->
<fo:block break-before=”page”>
A page break is inserted before this block.
Notice we have the headers and footers
in place. This was accomplished with the
fo-static-content elements. We can continue
on...business as usual.
</fo:block>
74. Graphics
• XSL-FO also allows for the insertion of external graphic
images.
• The graphic formats supported are dependent on the XSL-FO
formatting engine.
• The Apache-FOP formatting engine supports the popular
graphics formats: GIF, JPEG, and BMP.
Code to insert the image smiley.jpg:
<fo:block text-align=”center”>
<fo:external-graphic src=”smiley.jpg” width=”200px” height=”200px”/>
</fo:block>
7/29/2019 74Dr.S.Roselin Mary HOD/CSE
76. Write code fragments for the
following page
7/29/2019 76Dr.S.Roselin Mary HOD/CSE
77. <fo:table>
<!-- define column widths -->
<fo:table-column column-width=”120pt”/>
<fo:table-column column-width=”200pt”/>
<fo:table-column column-width=”80pt”/>
<fo:table-header>
<fo:table-row>
<fo:table-cell>
<fo:block font-weight=”bold”>Author</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-weight=”bold”>Title</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-weight=”bold”>Price (USD)</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<!-- insert table body and rows here -->
</fo:table>
Coding to create and define the column
width & table headers
7/29/2019 77Dr.S.Roselin Mary HOD/CSE
78. <fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block>Michael Daconta</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>XML Development with Java 2</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>37.99</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>E. Lynn Harris</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Any Way The Wind Blows</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>19.95</fo:block>
</fo:table-cell>
</fo:table-row>
Coding to include the data in the table cells
for each row
7/29/2019 78Dr.S.Roselin Mary HOD/CSE
85. Generating XSL-FO Tables Using XSLT
• the size of the document if we wanted to list
500 books, the document would be extremely
large and verbose.
• So, we’ll use XSLT to automatically generate
the XSL-FO document.
• The file, booklist.xml, contains a list of the
books.
• We can develop an XSL style sheet that will
automatically construct the XSL-FO document.
7/29/2019 85Dr.S.Roselin Mary HOD/CSE
87. • After reviewing the XSL-FO document for the book table, you can see that the
dynamic portion is the construction of each table row.
• We can use the element <xsl:for-each> to loop over each book and build the table
row.
This is accomplished with the following code:
<!-- Perform loop for each book in the book list -->
<xsl:for-each select=”booklist/book” >
<fo:table-row>
<fo:table-cell>[sr]
<fo:block><xsl:value-of select=”author” /> </fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block> <xsl:value-of select=”title” /> </fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block> <xsl:value-of select=”price” /> </fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
7/29/2019 87Dr.S.Roselin Mary HOD/CSE
88. Generating a PDF Document
• The first step involves XSLT processing the booklist.xml document
with booklist_table.xsl.
• The second step involves converting the output of the XSLT
conversion to a PDF file using XSL-FO.
• The Apache-FOP product can perform both of these steps internally.
All we have to do is provide the XML document and XSL style sheet.
• Follow these steps to generate the PDF document:
– 1. Open an MS-DOS window.
– 2. Move to the directory <install_dir>ch9_xslxsl_fodynamictable.
– 3. Set up the Java classpath by typing setpaths.
– 4. Execute Apache-FOP by typing the following:
– fop -xml booklist.xml -xsl booklist_table.xsl dyntable.pdf
– 5. View the dyntable.pdf file in Adobe Acrobat Reader.
7/29/2019 88Dr.S.Roselin Mary HOD/CSE