X hits on this document

437 views

0 shares

1 downloads

0 comments

49 / 142

Transforming XML with XSLT

<!-- cimi2html.xsl - convert a CIMI Schema document into a rudimentary HTML file - <!-- Eric Lease Morgan (emorgan@nd.edu) - October 20, 2003 -->

<!-- lots o' credit goes to Stephen Yearl of Yale who helped with XSL weirdness!

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:c="http://www.cimi.org/wg/xml_spectrum/Schema-v1.5" version="1.0">

<!-- output an HTML header --> <xsl:output method='html' doctype-public='-//W3C//DTD XHTML 1.0 Transitional//EN' doctype-system='http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd' indent='no' />

<!-- find the root of the input --> <xsl:template match="/">

<!-- start the XHTML output --> <html> <body> <h1>Water Collection</h1> <ol>

<!-- find all the Schemas object --> <xsl:apply-templates />

</ol> </body> </html> </xsl:template>

<!-- trap the objects of the file --> <xsl:template match="//c:object">

<!-- extract the parts of the object we desire and format them --> <li> <a> <xsl:attribute name='href'> <xsl:value-of select='./c:reproduction/c:location' /> </xsl:attribute> <xsl:value-of select='./c:identification/c:object-title/c:title' /> </a> - <xsl:value-of select='./c:identification/c:comments' /> (Collected by <xsl:value-of select='./c:acquisition/c:source/c:source/c:person/c:name/c:fore <xsl:value-of select='./c:acquisition/c:source/c:source/c:person/c:name/c:surn on <xsl:value-of select='./c:acquisition/c:accession-date/c:year' /> - <xsl:value-of select='./c:acquisition/c:accession-date/c:month' /> - <xsl:value-of select='./c:acquisition/c:accession-date/c:day' /> .) </li>

</xsl:template> </xsl:stylesheet>

41

Document info
Document views437
Page views443
Page last viewedThu Dec 08 06:55:10 UTC 2016
Pages142
Paragraphs3126
Words34660

Comments