logging in or signing up 17xsl Urania Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINTLite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 77 Category: Education License: All Rights Reserved Like it (0) Dislike it (0) Added: January 15, 2008 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript XSL: XSL Displaying XMLXSL Intro: XSL Intro Because XML does not use predefined tags (we can use any tags we want), the meanings of these tags are not understood: <table> could mean an HTML table or maybe a piece of furniture. Because of the nature of XML, the browser does not know how to display an XML document.XSL Intro – cont..: XSL Intro – cont.. In order to display XML documents, it is necessary to have a mechanism to describe how the document should be displayed. One of these mechanisms is CSS, but XSL (the eXtensible Stylesheet Language) is the preferred style sheet language of XML, and XSL is far more sophisticated than the CSS used by HTML.XSL consists of two parts:: XSL consists of two parts: a method for transforming XML documents a method for defining XML parts and patterns If you don't understand the meaning of this, think of XSL as a language that can transform XML into HTML, a language that can filter and sort XML data, a language that can address parts of an XML document, a language that can format XML data based on the data value, like displaying negative numbers in red, and a language that can output XML data to different devices, like screen, paper or voice XSL is Two Languages: XSL is Two Languages XSLT is a language to transform XML XPath is a language to define XML parts or patterns XSLT: XSLT XSLT is a language for transforming XML documents into other types of documents, or into other XML documents.XPath: XPath XPath is a language for addressing parts of an XML document. XPath was designed to be used by XSLT. XSL-XML Transformations: XSL-XML Transformations XSLT is the most important part of the XSL Standard. It is the part of XSL that is used to transform an XML document into another XML document, or another type of document. XSLT can be used to transform an XML document into a format that is recognizable to a browser. One such format is HTML. Normally XSLT does this by transforming each XML element into an HTML element. XML-XSL Transformations: XML-XSL Transformations XSLT can also add completely new elements into the output file, or remove elements. It can rearrange and sort the elements, and test and make decisions about which elements to display, and a lot more. XSL uses XSLT to transform an XML source tree into an XML result tree (or an XML source document into an XML result document)How Transformation Works: How Transformation Works In the transformation process, XSLT uses XPath to define parts of the source document that match one or more predefined templates. When a match is found, XSLT will transform the matching part of the source document into the result document. The parts of the source document that do not match a template will (as a general rule) end up unmodified in the result.Three Parts to Transformation: Three Parts to Transformation XML parser XML file XSL file You can use the built-in XML parser in IE 5.0. There are some limitations to it but it works ok. Most XML transformations are done server-side and then the transformed content is delivered to the browser. We can use CF or Java for thisXML Example: XML Example <?xml version="1.0"?> <CATALOG> <CD> <TITLE>Empire Burlesque</TITLE> <ARTIST>Bob Dylan</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia</COMPANY> <PRICE>10.90</PRICE> <YEAR>1985</YEAR> </CD> . . . </CATALOG> LinkXSL Example: XSL Example <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <html> <body> <table border="2" bgcolor="yellow"> <tr> <th>Title</th> <th>Artist</th> </tr> <xsl:for-each select="CATALOG/CD"> <tr> <td> <xsl:value-of select="TITLE"/></td> <td> <xsl:value-of select="ARTIST"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> LinkBeginning an XSLT StyleSheet: Beginning an XSLT StyleSheet 1<?xml version="1.0" ?> 2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" > 3</xsl:stylesheet> If you use IE as the processor change line 2 to: <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> Creating the root template: Creating the root template <?xml version="1.0" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> </xsl:template> </xsl:stylesheet> If this stylesheet was processed it would turn up an empty document, because we output 2 blank lines for the root elementOutputting HTML code: Outputting HTML code <?xml version="1.0" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <html><head> <title>Endangered Species</title> </head> <body bgcolor="white">- <p> Endangered animals face numerous threats. For more information, check out the World Wildlife Federation's <a href="http://www.worldwildlife.org/ species/species.cfm?">pages</a>. </p> <hr/> </body> </html> </xsl:template> </xsl:stylesheet>Outputting HTML code: Outputting HTML code <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Endangered Species</title> </head> <body bgcolor="white"> <p>Endangered animals face numerous threats. For more information, check out the World Wildlife Federation's <a href="http://www.worldwildlife.org/%20species/species.cfm?"> pages</a>. </p> <hr> </body> </html> LINKOutputting Node Content: Outputting Node Content <?xml version="1.0" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <html> <head><title>Endangered Species</title></head>- <body bgcolor="white">- <p> The mighty <xsl:value-of select="endangered_species/animal/name [@language='English']" /> faces numerous threats. For more information, check out the World Wildlife Federation's <a href="http://www.worldwildlife.org/ species/species.cfm?">pages</a> . </p><hr/> </body> </html> </xsl:template> </xsl:stylesheet>Outputting Node Content: Outputting Node Content <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Endangered Species </title> </head> <body bgcolor="white"> <p>The mighty Tiger faces numerous threats. For more information, check out the World Wildlife Federation's <a href="http://www.worldwildlife.org/%20species/species.cfm?"> pages</a>. </p> <hr> </body> </html> LinkCreating and Applying Template Rules: Creating and Applying Template Rules Template rules are modules that describe how a particular part of your source XML should be output. Link – XSL Link - HTMLAnother way to batch process Nodes: Another way to batch process Nodes The for-each method is usually used to build HTML tables Link – XSL Link - HTMLConditional Processing: Conditional Processing <xsl:if test=“.=0”> do something </xsl:if> Link – XSL Link - HTMLMore Conditional Processing: More Conditional Processing <xsl:choose> <xsl:when test=“expression”> do something </xsl:when> <xsl:when test=“expression”> do something </xsl:when> </xsl:choose> Link – XSL Link - HTMLSorting Nodes: Sorting Nodes <xsl:sort select=“criteria” data-type=“number”/> Link – XSL Link - HTML You do not have the permission to view this presentation. In order to view it, please contact the author of the presentation.
17xsl Urania Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINTLite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 77 Category: Education License: All Rights Reserved Like it (0) Dislike it (0) Added: January 15, 2008 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript XSL: XSL Displaying XMLXSL Intro: XSL Intro Because XML does not use predefined tags (we can use any tags we want), the meanings of these tags are not understood: <table> could mean an HTML table or maybe a piece of furniture. Because of the nature of XML, the browser does not know how to display an XML document.XSL Intro – cont..: XSL Intro – cont.. In order to display XML documents, it is necessary to have a mechanism to describe how the document should be displayed. One of these mechanisms is CSS, but XSL (the eXtensible Stylesheet Language) is the preferred style sheet language of XML, and XSL is far more sophisticated than the CSS used by HTML.XSL consists of two parts:: XSL consists of two parts: a method for transforming XML documents a method for defining XML parts and patterns If you don't understand the meaning of this, think of XSL as a language that can transform XML into HTML, a language that can filter and sort XML data, a language that can address parts of an XML document, a language that can format XML data based on the data value, like displaying negative numbers in red, and a language that can output XML data to different devices, like screen, paper or voice XSL is Two Languages: XSL is Two Languages XSLT is a language to transform XML XPath is a language to define XML parts or patterns XSLT: XSLT XSLT is a language for transforming XML documents into other types of documents, or into other XML documents.XPath: XPath XPath is a language for addressing parts of an XML document. XPath was designed to be used by XSLT. XSL-XML Transformations: XSL-XML Transformations XSLT is the most important part of the XSL Standard. It is the part of XSL that is used to transform an XML document into another XML document, or another type of document. XSLT can be used to transform an XML document into a format that is recognizable to a browser. One such format is HTML. Normally XSLT does this by transforming each XML element into an HTML element. XML-XSL Transformations: XML-XSL Transformations XSLT can also add completely new elements into the output file, or remove elements. It can rearrange and sort the elements, and test and make decisions about which elements to display, and a lot more. XSL uses XSLT to transform an XML source tree into an XML result tree (or an XML source document into an XML result document)How Transformation Works: How Transformation Works In the transformation process, XSLT uses XPath to define parts of the source document that match one or more predefined templates. When a match is found, XSLT will transform the matching part of the source document into the result document. The parts of the source document that do not match a template will (as a general rule) end up unmodified in the result.Three Parts to Transformation: Three Parts to Transformation XML parser XML file XSL file You can use the built-in XML parser in IE 5.0. There are some limitations to it but it works ok. Most XML transformations are done server-side and then the transformed content is delivered to the browser. We can use CF or Java for thisXML Example: XML Example <?xml version="1.0"?> <CATALOG> <CD> <TITLE>Empire Burlesque</TITLE> <ARTIST>Bob Dylan</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia</COMPANY> <PRICE>10.90</PRICE> <YEAR>1985</YEAR> </CD> . . . </CATALOG> LinkXSL Example: XSL Example <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <html> <body> <table border="2" bgcolor="yellow"> <tr> <th>Title</th> <th>Artist</th> </tr> <xsl:for-each select="CATALOG/CD"> <tr> <td> <xsl:value-of select="TITLE"/></td> <td> <xsl:value-of select="ARTIST"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> LinkBeginning an XSLT StyleSheet: Beginning an XSLT StyleSheet 1<?xml version="1.0" ?> 2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" > 3</xsl:stylesheet> If you use IE as the processor change line 2 to: <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> Creating the root template: Creating the root template <?xml version="1.0" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> </xsl:template> </xsl:stylesheet> If this stylesheet was processed it would turn up an empty document, because we output 2 blank lines for the root elementOutputting HTML code: Outputting HTML code <?xml version="1.0" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <html><head> <title>Endangered Species</title> </head> <body bgcolor="white">- <p> Endangered animals face numerous threats. For more information, check out the World Wildlife Federation's <a href="http://www.worldwildlife.org/ species/species.cfm?">pages</a>. </p> <hr/> </body> </html> </xsl:template> </xsl:stylesheet>Outputting HTML code: Outputting HTML code <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Endangered Species</title> </head> <body bgcolor="white"> <p>Endangered animals face numerous threats. For more information, check out the World Wildlife Federation's <a href="http://www.worldwildlife.org/%20species/species.cfm?"> pages</a>. </p> <hr> </body> </html> LINKOutputting Node Content: Outputting Node Content <?xml version="1.0" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <html> <head><title>Endangered Species</title></head>- <body bgcolor="white">- <p> The mighty <xsl:value-of select="endangered_species/animal/name [@language='English']" /> faces numerous threats. For more information, check out the World Wildlife Federation's <a href="http://www.worldwildlife.org/ species/species.cfm?">pages</a> . </p><hr/> </body> </html> </xsl:template> </xsl:stylesheet>Outputting Node Content: Outputting Node Content <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Endangered Species </title> </head> <body bgcolor="white"> <p>The mighty Tiger faces numerous threats. For more information, check out the World Wildlife Federation's <a href="http://www.worldwildlife.org/%20species/species.cfm?"> pages</a>. </p> <hr> </body> </html> LinkCreating and Applying Template Rules: Creating and Applying Template Rules Template rules are modules that describe how a particular part of your source XML should be output. Link – XSL Link - HTMLAnother way to batch process Nodes: Another way to batch process Nodes The for-each method is usually used to build HTML tables Link – XSL Link - HTMLConditional Processing: Conditional Processing <xsl:if test=“.=0”> do something </xsl:if> Link – XSL Link - HTMLMore Conditional Processing: More Conditional Processing <xsl:choose> <xsl:when test=“expression”> do something </xsl:when> <xsl:when test=“expression”> do something </xsl:when> </xsl:choose> Link – XSL Link - HTMLSorting Nodes: Sorting Nodes <xsl:sort select=“criteria” data-type=“number”/> Link – XSL Link - HTML