SlideServe
Menu
Preferences
© SlideServe · v2026

XSL

monifa avatar
12 slides · 466 Views · 120 likes · Sep 01, 2014

XSL. eXtensible Style Language. greeting.xml. <?xml version="1.0" standalone="yes"?> <GREETING> Hello XML! </GREETING>. greeting.xsl. <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <html> <body> <h1>

XSL - slide 1
01 / 12XSL
1 / 17

Download Presentation

XSL
An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

More Related Content

Presentation Transcript
  1. XSL • eXtensible Style Language

  2. greeting.xml • <?xml version="1.0" standalone="yes"?> • <GREETING> • Hello XML! • </GREETING>

  3. greeting.xsl • <?xml version="1.0"?> • <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> • <xsl:template match="/"> • <html> • <body> • <h1> • <xsl:value-of select="GREETING"/> • </h1> • </body> • </html> • </xsl:template> • </xsl:stylesheet>

  4. Attaching a style sheet to an XML document • xml-stylesheet processing instruction after the XML declaration and before the root element • type attribute has the value text/css or text/xsl • href attribute is a URL to the stylesheet, possibly relative

  5. The Extensible Style Language • Partially supported by IE 5.0 • Many third party tools • W3C Working Draft

  6. The Two Parts of XSL • Transformation Language • Formatting Objects

  7. Templates <HTML> <HEAD> <TITLE> XSL Instructions to get the title </TITLE> </HEAD> <H1>XSL Instructions to get the title</H1> <BODY> XSL Instructions to get the statistics </BODY> </HTML>

  8. XSL Instructions • An XSL style sheet is a well-formed XML document • XSL instructions are particular XML elements • xsl:apply-templates • xsl:template • xsl:for-each • xsl:value-of • a few others

  9. An XSL style sheet • <?xml version="1.0"?> • <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> • <xsl:template match="/"> • <HTML xmlns:xsl="http://www.w3.org/TR/WD-xsl"> • <HEAD><TITLE> • Major League Baseball Statistics • </TITLE></HEAD> • <BODY> • <H1>Major League Baseball Statistics</H1> • </BODY></HTML> • </xsl:template> • </xsl:stylesheet>

  10. xsl:for-each and xsl:value-of • <xsl:template match="/"> • <HTML • xmlns:xsl="http://www.w3.org/TR/WD-xsl"> • <HEAD><TITLE> • <xsl:for-each select="SEASON"> • <xsl:value-of select="@YEAR"/> • </xsl:for-each> • Major League Baseball Statistics • </TITLE></HEAD> • <BODY> • <xsl:for-each select="SEASON"> • <H1><xsl:value-of select="@YEAR"/> • Major League Baseball Statistics</H1> • </xsl:for-each> • </BODY></HTML> • </xsl:template>

  11. xsl:for-each and xsl:value-of <xsl:for-each select="SEASON"> <xsl:value-of select="@YEAR"/> </xsl:for-each>

  12. CSS or XSL? • CSS has broader support • CSS is more stable • XSL is more powerful