1 / 17

XML, XSL, XSLT, XHTML and others

XML, XSL, XSLT, XHTML and others. By Sean Hunter. Why XML?. XML was created to be a quick and easy way to provide structured data over the web. Existing HTML and SGML either did not allow arbitrary structure, or were too complex.

kelly-hill
Download Presentation

XML, XSL, XSLT, XHTML and others

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

Presentation Transcript


  1. XML, XSL, XSLT, XHTML and others By Sean Hunter

  2. Why XML? • XML was created to be a quick and easy way to provide structured data over the web. • Existing HTML and SGML either did not allow arbitrary structure, or were too complex. • XML’s simplicity allows programmers to write parsers for it quickly and easily.

  3. What is XML? • Extensible Markup Language • XML is a human readable database • XML is fully conformant SGML, but XML parsers do conform to all of SGML. • As any markup language, XML provides a way to create structure in a document

  4. Elements of XML • XML declaration: • <?xml version="1.0"?> • Not required, however it provides information on how to process the XML document • Tags: <A></A>, </A> • Attributes: </A name=“B”> • Values: <A>A’s Value</A>

  5. Example <?xml version="1.0"?> <list name=“Count”> <item>One</item> <item>Two</item> <item> <list> <item>One</item> </list> </item> </list>

  6. Document Type Definitions • Provides a way to standardize an XML document • Declares what elements can exist, what elements can nest in other elements, how many of a element are allowed, what attributes are allowed on a element, etc.

  7. Example <!ELEMENT LIST (ITEM*)> <!ELEMENT ITEM (#PCDATA|LIST)> The * means that a LIST element may contain zero or more ITEM’s. ITEM may contain either text (#PCDATA) or another LIST element.

  8. XSL and XSLT • Extensible Stylesheet Language Transformations • Provides a method to transmute XML into already existing data structures such as HTML, PDF, GIF, etc. • Sometimes companies want to keep the XML hidden, and only provide the transmuted data, or simply provide a more humanly readable format of their data.

  9. Example - XML <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href=“motd.xsl"?> <motd>xml.com</motd>

  10. Example - XSLT <?xml version="1.0"?> <html xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="1.0"> <body> Current message of the day: <i><xsl:value-of select=“motd"/></i> </body> </html>

  11. Result Current message of the day: xml.com

  12. XHTML • One major problem that many web designers have is that their website will look different across multiple different web browsers. Something on Firefox may look different from something on Opera, and IE. • XHTML creates a much stricter form of HTML that should, ideally, only have one way to be displayed across all browsers. • Because HTML does not have to be valid form for a browser to display it, XTML is preferred on cell phones and similar devices due to needing less processing to fix broken code.

  13. RDF • RDF: Resource Description Framework • A possible way of describing resources in the internet. • Ex (From xml.com): <rdf:Description about='http://www.textuality.com/RDF/Why-RDF.html'> <Author>Tim Bray</Author> <Home-Page rdf:resource='http://www.textuality.com' /> </rdf:Description>

  14. RSS • RDF Site Summary • A news feeder that many websites use to provide information about news on their website in a standard format using XML.

  15. <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">  <channel>    <title>XML.com</title>    <link>http://www.xml.com/</link>    <description>XML.com features a rich mix of information and services for the XML community.</description>    <language>en-us</language>    <item>      <title>Normalizing XML, Part 2</title>      <link>http://www.xml.com/pub/a/2002/12/04/normalizing.html</link>      <description>In this second and final look at applying relational normalization techniques to W3C XML Schema data modeling, Will Provost discusses when not to normalize, the scope of uniqueness and the fourth and fifth normal forms.</description>      <dc:creator>Will Provost</dc:creator>      <dc:date>2002-12-04</dc:date>        </item> • </channel> • </rss>

  16. XPath/XQuery • XPath: Used in XSL to find a particular element. Ex: body//p[position()=1] to get the first <p> element in <body> • XQuery: A programming language for use in XML • Example, combining XPath and XQuery to print the chapters in a book from an XML structure (Taken from xml.com): <html>{ let $book := document("mybook.xml")/book for $ch in $book/chapter return <h2>{$ch/title)</h2> }</html>

  17. References • O’Reilly’s XML.com • World Wide Web Consortium W3C.org

More Related