<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:researchnotes="http://www.pasteur.fr/ResearchNotes">

	<xsl:template match="/">

		<html>

			<body>

				<xsl:for-each select="//researchnotes:date">

					<xsl:variable name="ParentID">

						<xsl:value-of select="@ipad_parent_id"/>

					</xsl:variable>

					<u>

						<xsl:apply-templates select="." mode="date"/>

					</u>(<a href="{concat('../ViewContent.do?id2=',$ParentID)}">context</a>)<br/>

					<xsl:apply-templates select="." mode="toto"/>

				</xsl:for-each>

			</body>

		</html>

	</xsl:template>

	<xsl:template match="researchnotes:date" mode="date">

		<xsl:value-of select="substring(@date,9,2)"/>/<xsl:value-of select="substring(@date,6,2)"/>/<xsl:value-of select="substring(@date,3,2)"/></xsl:template>

	<xsl:template match="*" mode="toto">

		<xsl:element name="{local-name()}">

			<xsl:for-each select="attribute::*">

				<xsl:attribute name="{local-name()}">

					<xsl:if test="local-name()='href'">

						<xsl:variable name="URL">

							<xsl:value-of select="."/>

						</xsl:variable>

						<xsl:choose>

							<xsl:when test="substring($URL,1,14)='ipad:///attach'">

								<xsl:variable name="ID">

									<xsl:value-of select="substring($URL,19)"/>

								</xsl:variable>

								<xsl:value-of select="concat('/ipad-web/pages/attachment.jsp?id=',$ID)"/>

							</xsl:when>

							<xsl:when test="substring($URL,1,11)='ipad:///doc'">

								<xsl:variable name="ID">

									<xsl:value-of select="substring($URL,16)"/>

								</xsl:variable>

								<xsl:value-of select="concat('/ipad-web/Browse.do?id2=',$ID)"/>

							</xsl:when>

							<xsl:when test="substring($URL,1,11)='ipad:///tag'">

								<xsl:variable name="ID">

									<xsl:value-of select="substring($URL,16)"/>

								</xsl:variable>

								<xsl:value-of select="concat('/ipad-web/ViewContent.do?id2=',$ID)"/>

							</xsl:when>

							<xsl:otherwise>

								<xsl:value-of select="$URL"/>

							</xsl:otherwise>

						</xsl:choose>

					</xsl:if>

				</xsl:attribute>

			</xsl:for-each>

			<xsl:apply-templates select="node()" mode="toto"/>

		</xsl:element>

	</xsl:template>

</xsl:stylesheet>