Schemas, XSLT, XPath, XML Processing




CS257

Chris Pollett

Aug 31, 2020

Outline

Introduction

XML Schemas

More on Schemas

Overview of data types

Simple Types

Complex Types

References

Indicating the Schema Used By an XML document

XSLT

XSLT Example -- Initial XML Document

<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="xslplane.xsl" ?>
<plane>
    <year>1970</year>
</plane>

XSLT Example -- The Transformation

<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0"
    xmlns:xsl= "http://www.w3.org/1999/XSL/Transform"
   xmlns = "http://www.w3.org/1999/xhtml"
>
<xsl:template match="plane">
<html><head>
<title>result of applying a stylesheet to plane</title>
</head><body><h1>Plane Description</h1>
     <xsl:apply-templates />
     </body></html>
 </xsl:template>
<xsl:template match="year">
    <p style="color:red">
    <xsl:value-of select="." />
    </p>
</xsl:template>
</xsl:stylesheet>

Quiz

Which of the following is true?

  1. A semi-structured data model uses relations as it data structures, and uses relational algebra to specify its operations and constraints.
  2. An external DTD in XML could be specified with a line like:
    <!DOCTYPE name_of_xml_language SYSTEM "name_of_dtd_with_language_def.dtd" >
    
  3. An <!ATTLIST tag can be used to specify at most one attribute of at most one tag element of an XML language.

XPath

XPath Expressions