<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet [
	<!ENTITY e    "http://www.xs4all.nl/~pboot/p01/emblem.xml#" >
	<!ENTITY p01s "http://www.xs4all.nl/~pboot/p01/p01rdfs.rdf#" >
	<!ENTITY rdf  "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
	<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
	<!ENTITY % charrefs SYSTEM "entities.dtd">
	%charrefs;
]>
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  version="1.0"
  xmlns:saxon="http://icl.com/saxon"
  xmlns:p01s="http://www.xs4all.nl/~pboot/p01/p01rdfs.rdf#"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" 
  xmlns:pb="http://www.xs4all.nl/~pboot/"
  xmlns:func="http://exslt.org/functions"
  exclude-result-prefixes="saxon pb func rdf rdfs p01s"
  extension-element-prefixes="saxon pb func">

<xsl:include href="function.xsl"/>

<xsl:key name="subject" match="statement" use="subject/text()" />
<xsl:key name="object" match="statement" use="object/text()" />

<xsl:template match="/">
	<xsl:for-each select="//statement[predicate/text()='http://www.w3.org/1999/02/22-rdf-syntax-ns#type']">
		<saxon:output method="html" href="{concat(concat('outxml/',pb:local-part(subject/text())),'.html')}" omit-xml-declaration="yes">
		<html>
			<head>
				<title>explanation...</title>
			</head>
			<body>
			<p>
				<i>Selected sign:</i> 
				<a target="_top">
					<xsl:attribute name="href">
						<xsl:text>../signmodel.html?show=</xsl:text>
						<xsl:value-of select="pb:local-part(subject/text())"/> 
					</xsl:attribute>
					<xsl:value-of select="pb:local-part(subject/text())"/> 
				</a>
				<xsl:text> of class </xsl:text>
				<a target="_top">
					<xsl:attribute name="href">
						<xsl:text>../classmodel.html?showclass=</xsl:text>
						<xsl:value-of select="pb:local-part(object/text())"/> 
					</xsl:attribute>
					<xsl:value-of select="pb:local-part(object/text())"/> 
				</a>
				<xsl:text> with meaning (if any) '</xsl:text>
				<xsl:apply-templates select="key('subject',subject/text())[
					predicate/text()='http://www.xs4all.nl/~pboot/p01/p01rdfs.rdf#SignMeaningProp'
					]/object"/>
				<xsl:text>'. The sign's properties are: </xsl:text>
				<xsl:for-each select="key('subject',subject/text())[
					not(predicate/text()='http://www.xs4all.nl/~pboot/p01/p01rdfs.rdf#SignMeaningProp') and
					not(predicate/text()='http://www.w3.org/1999/02/22-rdf-syntax-ns#type')
					]">
						<xsl:text>- </xsl:text>
						<a target="_top">
							<xsl:attribute name="href">
								<xsl:text>../classmodel.html?showprop=</xsl:text>
								<xsl:value-of select="pb:local-part(predicate/text())"/> 
							</xsl:attribute>
							<xsl:value-of select="pb:local-part(predicate/text())"/> 
						</a>
						<xsl:text>: </xsl:text>
						<a target="_top">
							<xsl:attribute name="href">
								<xsl:text>../signmodel.html?show=</xsl:text>
								<xsl:value-of select="pb:local-part(object/text())"/> 
							</xsl:attribute>
							<xsl:value-of select="pb:local-part(object/text())"/> 
						</a>
						<xsl:text> (type </xsl:text>
						<xsl:for-each select="key('subject',object/text())[
							predicate/text()='http://www.w3.org/1999/02/22-rdf-syntax-ns#type'
							]">																																	<!-- for-each met 1 entry in result -->
							<a target="_top">
								<xsl:attribute name="href">
									<xsl:text>../classmodel.html?showclass=</xsl:text>
									<xsl:value-of select="pb:local-part(object/text())"/> 
								</xsl:attribute>
								<xsl:value-of select="pb:local-part(object/text())"/> 
							</a>
						</xsl:for-each>
						<xsl:text>, meaning '</xsl:text>
						<xsl:for-each select="key('subject',object/text())[
							predicate/text()='http://www.xs4all.nl/~pboot/p01/p01rdfs.rdf#SignMeaningProp'
							]">                                                                  <!-- for-each met 1 entry in result -->
							<xsl:value-of select="object/text()"/> 
						</xsl:for-each>
						<xsl:text>'); </xsl:text>
					</xsl:for-each>
			</p>
			</body>
		</html>
		</saxon:output>
	</xsl:for-each>
</xsl:template>

</xsl:stylesheet>

