<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ns="http://services.natureserve.org/docs/schemas/biodiversityDataFlow/1"
	xmlns:dc="http://purl.org/dc/terms/"
    version="1.0">
        
    <xsl:output method="html"/>
	
    <xsl:template match="/ns:images">
        <html>
            <head>
                <title>Golden Eagle Images report</title>
            </head>
            <body>
                <h1>Golden Eagle Images Report</h1>
				<h2>You should pay proper heed to all required copyright and permissions details when processing images.
					This report is for sample code purposes only and does a minimal job of addressing these concerns.
				</h2>
                <xsl:apply-templates select="ns:image" />
            </body>
        </html>
    </xsl:template>

    <xsl:template match="/ns:images/ns:image">
        <p>
			<a href="{normalize-space(dc:isVersionOf)}">
				<img src="{normalize-space(dc:identifier)}" title="{dc:title}"/>
			</a><br/>
			<xsl:value-of select="dc:title"/><br />
			<xsl:if test="dc:rightsHolder">
				<xsl:text>&#xA9; </xsl:text>
				<xsl:for-each select="dc:rightsHolder[position() != last()]">
					<xsl:value-of select="."/>
					<xsl:if test="position() != last()">
						<xsl:text>, </xsl:text>
					</xsl:if>
				</xsl:for-each>
				<br />
			</xsl:if>
			<xsl:value-of select="dc:rights"/>
		</p>
    </xsl:template>

</xsl:stylesheet>
