advertisement

17xsl

45 %
55 %
advertisement
Information about 17xsl
Education
xml

Published on January 15, 2008

Author: Urania

Source: authorstream.com

advertisement

XSL:  XSL Displaying XML XSL 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 this XML 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> Link XSL 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> Link Beginning 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 element Outputting 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> LINK Outputting 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> Link Creating 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 - HTML Another 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 - HTML Conditional Processing:  Conditional Processing <xsl:if test=“.=0”> do something </xsl:if> Link – XSL Link - HTML More 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 - HTML Sorting Nodes:  Sorting Nodes <xsl:sort select=“criteria” data-type=“number”/> Link – XSL Link - HTML

Add a comment

Related presentations

Related pages

www.17xdl.com # 冻疮怎么根治_祖传中药专治冻疮偏方100%根治 - 速效冻必治网

www.17xsl.com: www.17xcl.com: www.17xrl.com: www.17xwl.com: www.17xd.com: www.17xdi.com: www.17xd1.com: www.17xdk.com: www.17xdo.com: www.17xdp.com: www ...
Read more

Nachrichten | DW Nachrichten | DW (Deutsch) | 04.04.13 ...

Wir berichten zu relevanten Themen, die unsere Zuschauer weltweit bewegen. In 15- und 30-minütigen Sendungen präsentieren unsere DW Moderatoren spannende ...
Read more

Hitachi Interactive Solutions

Hitachi StarBoard presents the best presentation solutions in the world to satisfy all your collaboration needs; About Us; Learning Center; My Account;
Read more

docbook.sourceforge.net

docbook.sourceforge.net
Read more

Motor overheats in traffic, but not on freeway...Hydraulic Fan

Question - Motor overheats in traffic, but not on freeway...Hydraulic Fan - 5. Find the answer to this and other Toyota questions on JustAnswer.
Read more

诛仙2新手卡|笑傲江湖新手卡丨神魔大陆新手卡|笑傲江湖新手卡号丨17xsk.com

www.17xsl.com: www.17xso.com: www.17xsj.com: www.17xsm.com: www.17xsc.com: www.17xsu.com: www.17xskcom: www.17xsk.om: www.17xsk.vom: www.17xsk.dom: www ...
Read more

1--7--xsl熊胜龙 935043290@qq.com.doc - 爱问共享资料

1--7--xsl熊胜龙 935043290@qq.com.doc:经济的全球化和市场的动态化对旅游企业的要求越来越高,旅游需求的个性化 ...
Read more

Insurance promo codes starting 17XS

17xsa 17xsb 17xsc 17xsd 17xse 17xsf 17xsg 17xsh 17xsi 17xsj 17xsk 17xsl 17xsm 17xsn 17xso 17xsp 17xsq 17xsr 17xss 17xst 17xsu 17xsv 17xsw 17xsx 17xsy 17xsz ...
Read more

17xdl.com, www17xdl.com - 17xdl com | Website-dns.xyz

17xsl.com: 89%: 1: X425: SSLKM: DT A D M: 17xslcom: 82%: 2: X425: SSLKM: DT A D M: 17xxl.com: 89%: 1: X425: SLKM: DT A D M: 17xxlcom: 82%: 2: X425: SLKM ...
Read more

Opel Astra 1.3 CDTi Executive 2007 17-XS-L | AutoTrack

Bekijk deze Opel Astra 1.3 CDTi Executive 2007 17-XS-L Occasion op AutoTrack. Km-stand: 204.876 Onderhoudsboekje
Read more