<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<head>
<title>CPS Instructor/Course WebpageInstructors</h1>
<ul>
<xsl:for-each select="/*/instructor">
<li><xsl:value-of select="name"/></li>
</xsl:for-each>
</ul>
<h1>Courses</h1>
<ul>
<xsl:for-each select="*/course">
<li>
<b><xsl:value-of select="dept"/>
<xsl:text> </xsl:text>
<xsl:value-of select="no"/></b>
<xsl:text>: </xsl:text>
<xsl:value-of select="credits"/>
</li>
</xsl:for-each>
</ul>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
|
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml"/>
<xsl:template match="instructor">
<li><xsl:value-of select="name"/></li>
</xsl:template>
<xsl:template match="course">
<li>
<b><xsl:value-of select="dept"/>
<xsl:text> </xsl:text>
<xsl:value-of select="no"/></b>
<xsl:text>: </xsl:text>
<xsl:value-of select="credits"/>
</li>
</xsl:template>
<xsl:template match="/">
<html>
<head>
<title>CPS Instructor/Course Webpage</title>
</head>
<body>
<h1>Instructors
<ul>
<xsl:apply-templates select="*/instructor"/>
</ul>
<h1>Courses</h1>
<ul>
<xsl:apply-templates select="*/course"/>
</ul>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
|
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml"/>
<!-- query for instructors -->
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="course"/>
</xsl:stylesheet>
|
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml"/>
<!-- query for instructors and their attributes -->
<xsl:template match="*">
<xsl:copy>
<xsl:for-each select="@*"><xsl:copy/></xsl:for-each>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="course"/>
</xsl:stylesheet>
|
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml"/>
<!-- query for instructors who teach CPS 444 or CPS 445 -->
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="instructor[contains(@teaches, '444')] |
instructor[contains(@teaches, '445')]">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="instructor"/>
<xsl:template match="course"/>
</xsl:stylesheet>
|
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml"/>
<xsl:strip-space elements="*"/>
<!-- query for instructors and CPS 150 -->
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="course">
<xsl:if test="no[text()='150']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>
<xsl:template match="yea-last-day"/>
</xsl:stylesheet>
|
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml"/>
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="/">
<xsl:for-each select="*/instructor">
<xsl:copy>
<xsl:apply-templates/>
<xsl:variable name="tmp" select="@teaches"/>
<xsl:for-each select="following::course[contains($tmp, @cid)]">
<xsl:element name="teaches">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:element>
</xsl:for-each>
<xsl:for-each select="preceding::course[contains($tmp, @cid)]">
<xsl:element name="teaches">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:element>
</xsl:for-each>
</xsl:copy>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
|
| [DMXD] | S. S. Chawathe. Describing and Manipulating XML Data. Bulletin of the IEEE Computer Society Technical Committee on Data Engineering, Vol. 22, No. 3, pp. 3-9, September 1999. |
| [LXML] | E. T. Ray. Learning XML. O'Reilly, Second edition, 2003. |