<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cd="http://www.xces.org/schema/2003">

	<xsl:variable name="cssJsXsltBase">http://nlp.ilsp.gr/panacea/xces-xslt</xsl:variable>

	<xsl:template match="/">

		<html>
			<head>
				<meta http-equiv="content-type" content="text/html; charset=utf-8" />
				<title>
					<xsl:text>Annotated version of document with original title: </xsl:text>
					<xsl:value-of
						select="cd:cesDoc/cd:cesHeader/cd:fileDesc/cd:titleStmt/cd:title" />
					<xsl:text> (</xsl:text>
					<xsl:value-of
						select="cd:cesDoc/cd:cesHeader/cd:fileDesc/cd:sourceDesc/cd:biblStruct/cd:monogr/cd:imprint/cd:eAddress" />
					<xsl:text>)</xsl:text>
				</title>

				<link type="text/css"
					href="{$cssJsXsltBase}/css/sunny/jquery-ui-1.8.6.custom.css" rel="Stylesheet" />
				<link type="text/css" href="{$cssJsXsltBase}/css/custom.css"
					rel="Stylesheet" />

				<script type="text/javascript" src="{$cssJsXsltBase}/js/jquery-1.4.2.min.js" />
				<script type="text/javascript"
					src="{$cssJsXsltBase}/js/jquery-ui-1.8.6.custom.min.js" />


				<script type="text/javascript" src="{$cssJsXsltBase}/js/custom.js" />

				<script type="text/javascript">
					function ViewSource() {
					window.location =
					"view-source:" + window.location.href
					}
				</script>
			</head>

			<body>
				<div id="page-wrap">

					<div id="tabs">
						<ul>
							<li>
								<a href="#anno-text-tab">Annotated text</a>
							</li>
							<li>
								<a href="#metadata-tab">Metadata</a>
							</li>
						</ul>

						<div id="anno-text-tab">
							<h1>
								<xsl:value-of
									select="cd:cesDoc/cd:cesHeader/cd:fileDesc/cd:titleStmt/cd:title" />
							</h1>

							<div id="annoTextContainer" border="0">
								<xsl:for-each select="cd:cesDoc/cd:text/cd:body/cd:p">
									<div class="paraDiv">
										<div class="paraIdDiv">
											<xsl:value-of select="./@id"></xsl:value-of>
											<img class="copybutton" value="para"
												title="Copy the text of this paragraph to the clipboard"
												src="{$cssJsXsltBase}/css/copy.gif" width="14" height="14"
												border="0">
												<xsl:attribute name="eleId">
													 <xsl:value-of select="./@id" />
						 						</xsl:attribute>
											</img>
										</div>
										<div class="paraSentsDiv">
											<xsl:for-each select="cd:s">
												<div class="sentDiv">
													<div class="sentIdDiv">
														<xsl:value-of select="./@id"></xsl:value-of>
														<img class="copybutton" value="para"
															title="Copy the text of this sentence to the clipboard"
															src="{$cssJsXsltBase}/css/copy.gif" width="14" height="14"
															border="0">
															<xsl:attribute name="eleId">
															<xsl:value-of select="./@id" />
														</xsl:attribute>
														</img>
													</div>
													<div class="sentTextDiv">
														<xsl:for-each select="cd:t">
															<span class="tok">
																<xsl:value-of select="./@word"></xsl:value-of>
															</span>
															<xsl:if test="./@tag">
																<xsl:text> </xsl:text>
																<span class="posTag">
																	<xsl:value-of select="./@tag"></xsl:value-of>
																</span>
															</xsl:if>

															<xsl:if test="./@lemma">
																<xsl:text> </xsl:text>
																<span class="lemma">
																	<xsl:value-of select="./@lemma"></xsl:value-of>
																</span>
															</xsl:if>
															<xsl:text> </xsl:text>
														</xsl:for-each>
													</div>
												</div>
												<div class="sentClearDiv"></div>
											</xsl:for-each>
										</div>
									</div>
								</xsl:for-each>
							</div>
						</div>
						<div id="metadata-tab">
							<h1>
								<xsl:value-of
									select="cd:cesDoc/cd:cesHeader/cd:fileDesc/cd:titleStmt/cd:title" />
							</h1>


							<h2>
								<xsl:text>Bibliographical metadata</xsl:text>
							</h2>
							<table id="biblioTable" border="1" class="ui-widget">
								<thead class="ui-widget-header">
									<tr>
										<th>Attribute</th>
										<th>Value</th>
									</tr>
								</thead>
								<tbody class="ui-widget-content">
									<tr>
										<td>Title</td>
										<td>
											<xsl:value-of
												select="cd:cesDoc/cd:cesHeader/cd:fileDesc/cd:sourceDesc/cd:biblStruct/cd:monogr/cd:title" />
										</td>
									</tr>
									<tr>
										<td>Author</td>
										<td>
											<xsl:value-of
												select="cd:cesDoc/cd:cesHeader/cd:fileDesc/cd:sourceDesc/cd:biblStruct/cd:monogr/cd:author" />
										</td>
									</tr>
									<tr>
										<td>Publisher</td>
										<td>
											<xsl:value-of
												select="cd:cesDoc/cd:cesHeader/cd:fileDesc/cd:sourceDesc/cd:biblStruct/cd:monogr/cd:imprint/cd:publisher" />
										</td>
									</tr>
									<tr>
										<td>Retrieved on</td>
										<td>
											<xsl:value-of
												select="cd:cesDoc/cd:cesHeader/cd:fileDesc/cd:sourceDesc/cd:biblStruct/cd:monogr/cd:imprint/cd:pubDate" />
										</td>
									</tr>
									<tr>
										<td>URL</td>
										<td>
											<xsl:value-of
												select="cd:cesDoc/cd:cesHeader/cd:fileDesc/cd:sourceDesc/cd:biblStruct/cd:monogr/cd:imprint/cd:eAddress" />
										</td>
									</tr>
								</tbody>
							</table>


							<h2>
								<xsl:text>Classification metadata</xsl:text>
							</h2>
							<table id="classificationTable" border="1" class="ui-widget">
								<thead class="ui-widget-header">
									<tr>
										<th>Attribute</th>
										<th>Value</th>
									</tr>
								</thead>
								<tbody class="ui-widget-content">
									<tr>
										<td>Language</td>
										<td>
											<xsl:value-of
												select="cd:cesDoc/cd:cesHeader/cd:profileDesc/cd:langUsage/cd:language/@iso639" />
										</td>
									</tr>
									<tr>
										<td>Domain</td>
										<td>
											<xsl:value-of
												select="cd:cesDoc/cd:cesHeader/cd:profileDesc/cd:textClass/cd:domain" />
										</td>
									</tr>
									<tr>
										<td>
											<xsl:text>Keywords</xsl:text>
										</td>
										<td>
											<xsl:for-each
												select="cd:cesDoc/cd:cesHeader/cd:profileDesc/cd:textClass/cd:keywords/cd:keyTerm">
												<xsl:value-of select="." />
												<xsl:text> </xsl:text>
											</xsl:for-each>
										</td>
									</tr>
								</tbody>
							</table>


							<h2>
								<xsl:text>Processing metadata</xsl:text>
							</h2>
							<table id="procAnnotTable" border="1" class="ui-widget">
								<thead class="ui-widget-header">
									<tr>
										<th>Organization</th>
										<th>Task</th>
									</tr>
								</thead>
								<tbody class="ui-widget-content">
									<xsl:for-each
										select="cd:cesDoc/cd:cesHeader/cd:fileDesc/cd:titleStmt/cd:respStmt">
										<tr>
											<td>
												<xsl:value-of select="./cd:resp/cd:name" />
											</td>
											<td>
												<xsl:value-of select="./cd:resp/cd:type" />
											</td>
										</tr>
									</xsl:for-each>
								</tbody>
							</table>

							<h2>
								<xsl:text>Availability metadata</xsl:text>
							</h2>


							<table id="distroTable" border="1" class="ui-widget">
								<thead class="ui-widget-header">
									<tr>
										<th>Attribute</th>
										<th>Value</th>
									</tr>
								</thead>
								<tbody class="ui-widget-content">
									<tr>
										<td>
											<xsl:text>Distributor</xsl:text>
										</td>
										<td>
											<a>
												<xsl:attribute name="href">
								<xsl:value-of
													select="cd:cesDoc/cd:cesHeader/cd:fileDesc/cd:publicationStmt/cd:eAddress" />
									</xsl:attribute>
												<xsl:value-of
													select="cd:cesDoc/cd:cesHeader/cd:fileDesc/cd:publicationStmt/cd:distributor" />
											</a>
										</td>
									</tr>

									<tr>
										<td>
											<xsl:text>License</xsl:text>
										</td>
										<td>
											<xsl:value-of
												select="cd:cesDoc/cd:cesHeader/cd:fileDesc/cd:publicationStmt/cd:availability" />
										</td>
									</tr>

								</tbody>
							</table>
						</div>
					</div>

					<div id="accordion" class="ui-accordion" role="tablist">
						<div>
							<h3 class="ui-accordion-header">
<!--								class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-top"-->
<!--								role="tab" aria-expanded="true" tabindex="0">-->
<!--								<span class="ui-icon ui-icon-triangle-1-s"></span>-->
								<a href="#" tabindex="-1">Views</a>
							</h3>
							<div class="ui-accordion-content">
								<div>
									<a href="javascript:ViewSource()" id="showXML_B"
										class="ui-state-default ui-corner-all">XML Source</a>
								</div>
								<div>
									<a href="#" id="posTagShow" class="ui-state-default ui-corner-all">Show Tags</a>
									<br/>
									<a href="#" id="posTagHide" class="ui-state-default ui-corner-all">Hide Tags</a>
								</div>
								<div>
									<a href="#" id="lemmaShow" class="ui-state-default ui-corner-all">Show Lemmas</a>
									<br/>
									<a href="#" id="lemmaHide" class="ui-state-default ui-corner-all">Hide Lemmas</a>
								</div>

								<p> Document annotated by <a href="http://nlp.ilsp.gr/soaplab2-axis/">ILSP NLP Tools</a>.
									Developed in the framework of
									<a href="http://www.panacea-lr.eu">Panacea</a>
									, an EU
									<a href="http://cordis.europa.eu/fp7/ict/language-technologies/"> Language Technologies</a>
									project.
								</p>
								<!-- <a href="http://www.panacea-lr.eu"> <img alt="Panacea Home"
									width="50" height="50" src="http://www.panacea-lr.eu/images/img_logo_panacea_alpha_150.gif"
									/> </a> -->
							</div>
						</div>
					</div>
				</div>
			</body>
		</html>
	</xsl:template>
</xsl:stylesheet>


