This assignment is about using Extensible Stylesheet Language Transformations (XSLT). Code for each transformation is linked to a spot lower down the page. Sue's XMLhomepage also containslinks to the results. The XML for each transformation is the same (other than a pointer to a different XSL file depending on the transformation.) The CSS file is also the same for each transformation.
Digital Library Collection basic XML (resourcestransform.xml and resourcestransform a, b and c)
CSS style sheet for these transformations (transtylesheet.css)
XSLT for the whole enchilada [libcollectlink.xsl ] This transformation takes the data from the Digital Library Collection XML file and puts it into a table with headings.
[ Transformation Result ]
Transform 1 [libcollectalink.xsl] XSLT shows the name and the URL for each collection. Collection names are sorted in alpha order.
[ Transformation Result ]
Transform 2 [libcollectblink.xsl ] XSLT template match for name and description elements. Non-table display.
Transform 3 [libcollectc.xsl ] XSLT choose used to highlight name when review date is equal to 2005-10-10.
<?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="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-quiv="Content-Type" content="text/html; charset=UTF-8" />
<head><title>Digital Library Collections Complete</title>
<link rel="stylesheet" type="text/css" href="transtylesheet.css"/>
</head>
<body>
<xsl:for-each select="resources">
<h1>Digital Library Collections - Whole enchilada</h1>
<p>This transformation shows all the data for the collections. <br />See<a href="about4.htm" target="_blank"> about the XSLT</a> for all the code for each Digital Library transformation (including this one.)</p>
<table border="1" cellpadding="5px">
<tr bgcolor="#003399">
<th>Name</th>
<th>Sponsor</th>
<th>Description</th>
<th>Comments</th>
<th>Review Date</th>
<th>Location</th>
</tr>
<xsl:for-each select="collection">
<tr>
<td valign="top" >
<xsl:for-each select="name">
<xsl:apply-templates />
</xsl:for-each>
</td>
<td valign="top">
<xsl:for-each select="sponsor">
<p><xsl:value-of select="sponsor" /></p>
<xsl:apply-templates />
</xsl:for-each>
</td>
<td valign="top">
<xsl:for-each select="description">
<xsl:apply-templates />
</xsl:for-each>
</td>
<td valign="top">
<xsl:for-each select="comments">
<xsl:apply-templates />
</xsl:for-each>
</td>
<td valign="top">
<xsl:for-each select="reviewdate">
<xsl:apply-templates />
</xsl:for-each>
</td>
<td valign="top">
<a href="{location}"><xsl:value-of select="location" /></a>
</td>
</tr>
</xsl:for-each>
</table>
<p>This page updated March 10, 2006.</p>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<?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="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<link rel="stylesheet" type="text/css" href="transtylesheet.css"/>
<head><title>Digital Library Name and Location</title></head>
<body>
<h1>Digital Library Collection - Transformation 1 </h1>
<p>This transformation shows the name and the URL for each collection. Collection names are sorted in alpha order.</p>
<table border="1" cellpadding="5px">
<tr bgcolor="#003399">
<th>Name</th>
<th>Location</th>
</tr>
<xsl:for-each select="resources/collection">
<xsl:sort select="name"/>
<tr>
<td><xsl:value-of select="name"/></td>
<td><a href="{location}"><xsl:value-of select="location" /></a></td>
</tr>
</xsl:for-each>
</table>
<p>This page updated March 10, 2006.</p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<?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="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<link rel="stylesheet" type="text/css" href="transtylesheet.css"/>
<head><title>Digital Library Name and Description</title></head>
<body>
<h1>Digital Library Collection - Transformation 2</h1>
<p>Template match for name and description elements. Non-table display.</p>
<xsl:apply-templates/>
<p>This page updated March 10, 2006.</p>
</body>
</html>
</xsl:template>
<xsl:template match="collection">
<xsl:apply-templates select="name" />
<xsl:apply-templates select="description" />
<xsl:apply-templates select="location" />
<hr />
</xsl:template>
<xsl:template match="name">
<strong>Name: </strong><span style = "color:#003399">
<xsl:value-of select="." /></span>
<br />
</xsl:template>
<xsl:template match="description">
<strong>Description: </strong><span style = "color:#000000">
<xsl:value-of select="." /></span>
<br />
</xsl:template>
<xsl:template match="location">
<strong>Location: </strong><a href="{.}">
<xsl:value-of select="." />
</a>
<br />
</xsl:template>
</xsl:stylesheet>
<?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="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<link rel="stylesheet" type="text/css" href="transtylesheet.css"/>
<head><title>Digital Library Highlighted by Review Date</title></head>
<body>
<h1>Digital Library Collections - Transformation 3</h1>
<p><em>Choose</em> used to highlight <em> name</em> when <em>review date</em> is equal to 2005-10-10.</p>
<table border="1" cellpadding="5px">
<tr bgcolor="#003399">
<th>Review Date</th>
<th>Name</th>
</tr>
<xsl:for-each select="resources/collection">
<tr>
<td><xsl:value-of select="reviewdate"/></td>
<xsl:choose>
<xsl:when test="reviewdate='2005-10-10'">
<td bgcolor="#99CCFF">
<xsl:value-of select="name" /></td>
</xsl:when>
<xsl:otherwise>
<td><xsl:value-of select="name" /></td>
</xsl:otherwise>
</xsl:choose>
</tr>
</xsl:for-each>
</table>
<p>This page updated March 10, 2006.</p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="libcollect.xsl"?>
<resources>
<collection>
<name>American Memory</name>
<sponsor>Library of Congress</sponsor>
<description>American history and culture, broad coverage from architecture to sports and technology. Includes digitized historical documents, photographs, sound recordings, moving pictures, books, pamphlets, and maps.</description>
<comments>Browse collections by topic.</comments>
<reviewdate>2005-10-10</reviewdate>
<location>http://memory.loc.gov/ammem/</location>
</collection>
<collection>
<name>NYPL Digital Gallery</name>
<sponsor>New York Public Library</sponsor>
<description>Another broad collection including materials in the areas Arts and Literature, Cities and Buildings, Science and Technology and far more. Photographs, prints and historical documents.</description>
<comments>Collection guides available. Love the New York City photos.</comments>
<reviewdate>2005-12-05</reviewdate>
<location>http://digitalgallery.nypl.org/nypldigital/</location>
</collection>
<collection>
<name>Digital Library for the Decorative Arts and Material Culture</name>
<sponsor>University of Wisconsin-Madison</sponsor>
<description>Electronic resources for study and research in the decorative arts, with focus on early America.</description>
<comments>Useful links to resources and guides.See the tea pots!</comments>
<reviewdate>2005-10-10</reviewdate>
<location>http://digital.library.wisc.edu/1711.dl/DLDecArts</location>
</collection>
<collection>
<name>ARTstor Digital Library</name>
<sponsor>The Andrew W. Mellon Foundation</sponsor>
<description>Images covering art, architecture and archeology.</description>
<comments>Images are available for educational and scholarly use (noncommercial). Visual sister of JSTOR. </comments>
<reviewdate>2006-02-06</reviewdate>
<location>http://www.artstor.org/info/</location>
</collection>
<collection>
<name>International Children's Digital Library</name>
<sponsor>University of Maryland</sponsor>
<sponsor>National Science Foundation (NSF)</sponsor>
<sponsor>Institute for Museum and Library Services (IMLS)</sponsor>
<description>A digital collection of children's books. Contains 904 books in 34 different languages.</description>
<comments>Designed for children 3-13 years old.</comments>
<reviewdate>2005-03-01</reviewdate>
<location>http://www.icdlbooks.org/</location>
</collection>
</resources>
/* CSS Document */
body {
background-color: #ffffff;
font-family: arial, verdana, sans-serif;
font-size: 90%;
margin-left: 5%;
margin-right: 5%;
}
table {
background-color:#ffffff;
font-family: arial, verdana, sans-serif;
font-size: 90%;
}
h1{
font-size: 110%;
}
h2{
font-size: 100%;
color:#66CCCC;
font-weight:bold;
}
th{
color:#FFFFFF;
}