<?xml version="1.0"  encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template name="interLinks">
		<xsl:param name="target" />
		<xsl:param name="caption" />
		<xsl:if test="(($target != 'null') and ($target != ''))">
			<a>
				<xsl:attribute name="href">
			<xsl:variable name="showNavigation">
		<xsl:choose>
		<xsl:when test="contains($target,'navi=')">
		  <!--Parameter schon fest angegeben-->
		  <xsl:text></xsl:text>
	    </xsl:when>
		<xsl:when test="not(contains($target,'navi=')) and /*/@showNavigation='false'">
		   <xsl:text>navi=false&amp;</xsl:text>
		</xsl:when>
		<xsl:otherwise>
		   <xsl:text>navi=true&amp;</xsl:text>
		</xsl:otherwise>
		</xsl:choose>
		</xsl:variable>
<xsl:choose>
<xsl:when test="starts-with($target,'nexttable:')">
<xsl:value-of
					select="concat('SuperXmlTabelle','?',$showNavigation,'tid=',substring-after($target,'nexttable:'))" />
</xsl:when>
<xsl:when test="starts-with($target,'nextmask:')">
<xsl:value-of
					select="concat('SuperXmlMaske','?',$showNavigation,'tid=',substring-after($target,'nextmask:'))" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$target" />
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<![CDATA[]]>
				<xsl:value-of select="$caption" /><![CDATA[]]>
			</a>
		</xsl:if>
	</xsl:template>
	<xsl:template name="resultsetLink">
		<xsl:param name="zs2" />
		<xsl:variable name="showNavigation">
		<xsl:choose>
		<xsl:when test="contains($zs2,'navi=')">
		  <!--Parameter schon fest angegeben-->
		  <xsl:text></xsl:text>
	    </xsl:when>
		<xsl:when test="not(contains($zs2,'navi=')) and /*/@showNavigation='false'">
		   <xsl:text>navi=false&amp;</xsl:text>
		</xsl:when>
		<xsl:otherwise>
		   <xsl:text>navi=true&amp;</xsl:text>
		</xsl:otherwise>
		</xsl:choose>
		</xsl:variable>
		<xsl:choose>
			<xsl:when
				test="starts-with(f_name,'email') or starts-with(f_name,'E-mail')">
				<a>
					<xsl:attribute name="href">mailto:<xsl:value-of
						select="$zs2" /></xsl:attribute>
					<xsl:value-of select="$zs2" />
				</a>
			</xsl:when>
			<xsl:when
				test="f_name='url' or starts-with(f_name,'www') or starts-with(f_name,'WWW')">
				<a target="_blank">
					<xsl:attribute name="href"><xsl:value-of
						select="$zs2" /></xsl:attribute>
					<xsl:value-of select="$zs2" />
				</a>
			</xsl:when>
			<xsl:when test="starts-with(f_name,'nextmask')">

				<xsl:variable name="derwert" select="$zs2" />
				<xsl:if test="(($derwert != 'null') and ($derwert != ''))">
					<div align="center">
						<a target="_blank">
							<xsl:attribute name="href">
			<xsl:value-of
								select="'SuperXmlMaske'" />
	<xsl:text>?</xsl:text><xsl:value-of select="$showNavigation"/><xsl:text>tid=</xsl:text><xsl:value-of select="$derwert" />
			</xsl:attribute>
							<img src="../images/weiter.png" border="0" alt="Bearbeiten" />
						</a>
					</div>
				</xsl:if>

			</xsl:when>
			<xsl:when test="starts-with(f_name,'nexttable')">

				<xsl:variable name="derwert" select="$zs2" />

				<xsl:if test="(($derwert != 'null') and ($derwert != ''))">
					<div align="center">
						<a>
							<xsl:attribute name="href">
			<xsl:value-of
								select="'SuperXmlTabelle'" />
	<xsl:text>?</xsl:text><xsl:value-of select="$showNavigation"/><xsl:text>tid=</xsl:text><xsl:value-of select="$derwert" /></xsl:attribute>
							<img src="../images/information.svg" class="svg_icon" border="0" alt="Ansehen" />
						</a>
					</div>
				</xsl:if>

			</xsl:when>
			<xsl:when test="starts-with(f_name,'nextpage')">

				<xsl:variable name="derwert" select="$zs2" />

				<xsl:if test="(($derwert != 'null') and ($derwert != ''))">
					<div align="center">
						<a>
							<xsl:attribute name="href">
			<xsl:value-of
								select="'SuperXmlTabelle'" />
	<xsl:text>?</xsl:text><xsl:value-of select="$showNavigation"/><xsl:text>tid=</xsl:text><xsl:value-of select="$derwert" /></xsl:attribute>
							<!--<img src="../images/more.gif" border="0" alt="Weitere Details" 
								/> -->
				<![CDATA[@@nextpage@@]]>
						</a>
					</div>
				</xsl:if>

			</xsl:when>
			<!-- MB nextwindowtable same as nexttable but with target blank -->
			<xsl:when test="starts-with(f_name,'nextwindowtable')">

				<xsl:variable name="derwert" select="$zs2" />

				<xsl:variable name="caption" select="substring-before($derwert,'|') " />
				<xsl:variable name="href" select="substring-after($derwert,'|') " />

				<xsl:if test="(($derwert != 'null') and ($derwert != ''))">
					<div align="center">
						<a>
							<xsl:attribute name="target">_blank</xsl:attribute>
							<xsl:attribute name="href">
			<xsl:value-of
								select="'SuperXmlTabelle'" />
			<xsl:choose>
			<xsl:when test="(contains($derwert,'|'))">
			<xsl:text>?</xsl:text><xsl:value-of select="$showNavigation"/><xsl:text>tid=</xsl:text><xsl:value-of select="$href" />
			</xsl:when>
			<xsl:otherwise>
			<xsl:text>?</xsl:text><xsl:value-of select="$showNavigation"/><xsl:text>tid=</xsl:text><xsl:value-of select="$derwert" />
			</xsl:otherwise>
			</xsl:choose>
			</xsl:attribute>
							<xsl:choose>
								<xsl:when test="(contains($derwert,'|'))">
			<![CDATA[]]>
									<xsl:value-of select="$caption" /><![CDATA[]]>
								</xsl:when>
								<xsl:otherwise>
									<img src="../images/information.svg" class="svg_icon" border="0" alt="Ansehen" />
								</xsl:otherwise>
							</xsl:choose>
						</a>
					</div>
				</xsl:if>

			</xsl:when>
			<xsl:when test="starts-with(f_name,'nextdelete')">

				<xsl:variable name="derwert" select="$zs2" />

				<xsl:if test="(($derwert != 'null') and ($derwert != ''))">
					<div align="center">
						<a>
							<xsl:attribute name="href">
			<xsl:value-of
								select="'SuperXmlMaske'" />
	<xsl:text>?</xsl:text><xsl:value-of select="$showNavigation"/><xsl:text>tid=</xsl:text><xsl:value-of select="$derwert" />
</xsl:attribute>
							<img src="../images/delete.svg" class="svg_icon" border="0" alt="Löschen" />
						</a>
					</div>
				</xsl:if>

			</xsl:when>
			<!-- fuer Tabellen -->
			<xsl:when test="starts-with(f_name,'nextlink')">

				<xsl:variable name="derwert" select="$zs2" />
				<xsl:if test="($derwert != 'null') and ($derwert != '')">

					<xsl:choose>
						<xsl:when test="(contains($derwert,'|'))">

							<xsl:variable name="caption" select="substring-before($derwert,'|') " />
							<xsl:variable name="href" select="substring-after($derwert,'|') " />
							<xsl:choose>
								<xsl:when test="starts-with($href,'http')">
									<a target="_parent">
										<xsl:attribute name="href">
			<xsl:value-of select="$href" /></xsl:attribute>
				<![CDATA[]]>
										<xsl:value-of select="$caption" /><![CDATA[]]>
									</a>
								</xsl:when>
								<xsl:when test="$href='' or $href = null">
			<![CDATA[]]>
									<xsl:value-of select="$caption" /><![CDATA[]]>
								</xsl:when>
								<xsl:otherwise>
									<a target="_self">
										<xsl:attribute name="href"><xsl:value-of
											select="concat('SuperXmlTabelle','?',$showNavigation,'tid=',$href)" /></xsl:attribute>
				<![CDATA[]]>
										<xsl:value-of select="$caption" /><![CDATA[]]>
									</a>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:when>
						<xsl:otherwise>
							<xsl:copy-of select="$zs2" />
						</xsl:otherwise>
					</xsl:choose>
				</xsl:if>

			</xsl:when>

			<!-- für generische LInks mit optional JSESSIONID ersetzt -->
			<xsl:when test="starts-with(f_name,'nextgenericlink')">

				<xsl:variable name="derwert" select="$zs2" />
				<xsl:if test="($derwert != 'null') and ($derwert != '')">

					<xsl:choose>
						<xsl:when test="(contains($derwert,'|'))">

							<xsl:variable name="caption" select="substring-before($derwert,'|') " />
							<xsl:variable name="href" select="substring-after($derwert,'|') " />
							<xsl:choose>
								<xsl:when test="starts-with($href,'http')">
									<a target="_parent">
										<xsl:attribute name="href">
			<xsl:value-of select="$href" /></xsl:attribute>
				<![CDATA[]]>
										<xsl:value-of select="$caption" /><![CDATA[]]>
									</a>
								</xsl:when>
								<xsl:when test="$href='' or $href = null">
			<![CDATA[]]>
									<xsl:value-of select="$caption" /><![CDATA[]]>
								</xsl:when>
								<xsl:otherwise>
									<a target="_self"> <!--MB see here -->
										<xsl:variable name="jsessreplace">
											<xsl:call-template name="search_replace">
												<xsl:with-param name="string" select="$href" />
												<xsl:with-param name="search" select="'JSESSIONID'" />
												<xsl:with-param name="replace"
													select="concat(';jsessionid=',/ergebnisse/@jsessionid )" />
											</xsl:call-template>
										</xsl:variable>
										<xsl:attribute name="href"><xsl:value-of
											select="$jsessreplace" /></xsl:attribute>
				<![CDATA[]]>
										<xsl:value-of select="$caption" /><![CDATA[]]>
									</a>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:when>
						<xsl:otherwise>
							<xsl:copy-of select="$zs2" />
						</xsl:otherwise>
					</xsl:choose>
				</xsl:if>

			</xsl:when>
			<!-- nextwindowgenericlink wie generich link nur mit Target _blank -->
			<xsl:when test="starts-with(f_name,'nextwindowgenericlink')">
              <div align="center">
				<xsl:variable name="derwert" select="$zs2" />
				<xsl:if test="($derwert != 'null') and ($derwert != '')">

					<xsl:choose>
						<xsl:when test="(contains($derwert,'|'))">

							<xsl:variable name="caption" select="substring-before($derwert,'|') " />
							<xsl:variable name="href" select="substring-after($derwert,'|') " />
							<xsl:choose>
								<xsl:when test="starts-with($href,'http')">
									<a target="_blank">
										<xsl:attribute name="href">
			<xsl:value-of select="$href" /></xsl:attribute>
				<![CDATA[]]>
							<xsl:choose>
							<xsl:when test="starts-with($caption,'img:')">
							<img>
							<xsl:attribute name="src"><xsl:value-of select="substring-after($caption,'img:')"/>
							</xsl:attribute>
							</img>
							</xsl:when>
							<xsl:otherwise>
							<xsl:value-of select="$caption" />
							</xsl:otherwise>
							</xsl:choose>
							<![CDATA[]]>
									</a>
								</xsl:when>
								<xsl:when test="$href='' or $href = null">
			<![CDATA[]]>
									<xsl:value-of select="$caption" /><![CDATA[]]>
								</xsl:when>
								<xsl:otherwise>
									<a target="_blank"> 
										<xsl:variable name="jsessreplace">
											<xsl:call-template name="search_replace">
												<xsl:with-param name="string" select="$href" />
												<xsl:with-param name="search" select="'JSESSIONID'" />
												<xsl:with-param name="replace"
													select="concat(';jsessionid=',/ergebnisse/@jsessionid )" />
											</xsl:call-template>
										</xsl:variable>
										<xsl:attribute name="href"><xsl:value-of
											select="$jsessreplace" /></xsl:attribute>
				<![CDATA[]]>
										<xsl:choose>
							<xsl:when test="starts-with($caption,'img:')">
							<img>
							<xsl:attribute name="src"><xsl:value-of select="substring-after($caption,'img:')"/>
							</xsl:attribute>
							</img>
							</xsl:when>
							<xsl:otherwise>
							<xsl:value-of select="$caption" />
							</xsl:otherwise>
							</xsl:choose>
							<![CDATA[]]>
									</a>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:when>
						<xsl:otherwise>
							<xsl:copy-of select="$zs2" />
						</xsl:otherwise>
					</xsl:choose>
				</xsl:if>
                </div>
			</xsl:when>
			
			<xsl:when test="starts-with(f_name,'nextedit')">

				<xsl:variable name="derwert" select="$zs2" />
				<xsl:if test="($derwert != 'null') and ($derwert != '')">
					<div align="center">
						<xsl:choose>
							<xsl:when test="(contains($derwert,'|'))">
								<xsl:variable name="url"
									select="substring-before($derwert,'|') " />
								<xsl:variable name="params" select="substring-after($derwert,'|') " />
								<a target="nextedit">
									<xsl:attribute name="href"><xsl:value-of
										select="concat($url,'?',$params)" />
			</xsl:attribute>
									<xsl:attribute name="onClick"><xsl:text>javascript:neu=window.open('</xsl:text><xsl:value-of
										select="concat($url,'?',$params)" />
			<xsl:text>','_blank','directories=no,location=no,menubar=no,scrollbars=yes,resizable=yes,toolbar=no</xsl:text><xsl:if
										test="not( contains(f_name,'big'))"><xsl:text>,width=800,height=600</xsl:text></xsl:if><xsl:text>'); return false;</xsl:text></xsl:attribute>

									<img src="../images/pencil.svg" class="svg_icon" border="0" alt="Bearbeiten" title="Bearbeiten" />
								</a>
							</xsl:when>
							<xsl:otherwise>
								<a target="nextedit">
									<xsl:attribute name="href"><xsl:value-of
										select="$derwert" />
			</xsl:attribute>
									<xsl:attribute name="onClick"><xsl:text>javascript:neu=window.open('</xsl:text><xsl:value-of
										select="$derwert" />
			<xsl:text>','_blank','directories=no,location=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes</xsl:text><xsl:if
										test="not( contains(f_name,'big'))"><xsl:text>,width=800,height=600</xsl:text></xsl:if><xsl:text>'); return false;</xsl:text></xsl:attribute>
									<img src="../images/pencil.svg" class="svg_icon" border="0" alt="Bearbeiten" title="Bearbeiten" />
								</a>

							</xsl:otherwise>
						</xsl:choose>
					</div>
				</xsl:if>

			</xsl:when>

			<!-- Link auf eine andere Seite auf dem aktuellen Server, z.B. die vorgeschaltete 
				HISinOne-Instanz -->
			<xsl:when test="starts-with(f_name,'nextserverlink')">
				<xsl:variable name="derwert" select="$zs2" />
				<xsl:if test="($derwert != 'null') and ($derwert != '')">
					<xsl:choose>
						<xsl:when test="(contains($derwert,'|'))">
							<xsl:variable name="caption" select="substring-before($derwert,'|') " />
							<xsl:variable name="href" select="substring-after($derwert,'|') " />
							<a target="_parent">
								<xsl:attribute name="href">
										<xsl:value-of select="$href" /></xsl:attribute>
										<![CDATA[]]>
								<![CDATA[]]>
								<xsl:attribute name="onmouseout">									
										<![CDATA[]]>
										<xsl:value-of select="$caption" /><![CDATA[]]>
								</xsl:attribute>
								<xsl:value-of select="$caption" />
								<img src="../images/pencil.svg" class="svg_icon" border="0" alt="Link öffnen" />
							</a>
						</xsl:when>
						<xsl:otherwise>
							<xsl:copy-of select="$zs2" />
						</xsl:otherwise>
					</xsl:choose>
				</xsl:if>
			</xsl:when>

			<!-- Link auf eine Wiki Doku-->
			<xsl:when test="starts-with(f_name,'nextdokulink')">
				<xsl:variable name="derwert" select="$zs2" />
				<xsl:if test="($derwert != 'null') and ($derwert != '')">
					<xsl:choose>
						<xsl:when test="(contains($derwert,'|'))">
							<xsl:variable name="caption" select="substring-before($derwert,'|') " />
							<xsl:variable name="href" select="substring-after($derwert,'|') " />
							<a target="_parent">
								<xsl:attribute name="href">
										<xsl:value-of select="$href" /></xsl:attribute>
										<![CDATA[]]>
								<![CDATA[]]>
								<xsl:attribute name="onmouseout">									
										<![CDATA[]]>
										<xsl:value-of select="$caption" /><![CDATA[]]>
								</xsl:attribute>
								<xsl:value-of select="$caption" />
								<img src="../images/icons/help.svg" class="svg_icon" border="0" alt="Doku Link öffnen" />
							</a>
						</xsl:when>
						<xsl:otherwise>
							<xsl:copy-of select="$zs2" />
						</xsl:otherwise>
					</xsl:choose>
				</xsl:if>
			</xsl:when>

			<xsl:otherwise>
				<xsl:copy-of select="$zs2" />
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="sidebar_link">
		<xsl:param name="caption" />
		<xsl:param name="href" />
		<xsl:param name="target" />
		<xsl:variable name="href_1">
			<xsl:call-template name="get_colvalue">
				<xsl:with-param name="colname">
					<xsl:value-of select="$href" />
				</xsl:with-param>
			</xsl:call-template>
		</xsl:variable>
			<xsl:variable name="showNavigation">
		<xsl:choose>
		<xsl:when test="contains($href_1,'navi=')">
		  <!--Parameter schon fest angegeben-->
		  <xsl:text></xsl:text>
	    </xsl:when>
		<xsl:when test="not(contains($href_1,'navi=')) and /*/@showNavigation='false'">
		   <xsl:text>navi=false&amp;</xsl:text>
		</xsl:when>
		<xsl:otherwise>
		   <xsl:text>navi=true&amp;</xsl:text>
		</xsl:otherwise>
		</xsl:choose>
		</xsl:variable>
		
		<xsl:if test="string-length($href_1) &gt; 0 ">
			<li>
				<xsl:choose>
					<xsl:when test="starts-with($href_1,'http://')">
						<a target="_blank">
							<xsl:attribute name="href"><xsl:value-of
								select="$href_1" /></xsl:attribute><![CDATA[]]>
							<xsl:value-of select="$caption" /><![CDATA[]]>
						</a>

					</xsl:when>
					<xsl:when test="starts-with($href,'email') ">
						<a>
							<xsl:attribute name="href">
	<xsl:text>mailto:</xsl:text><xsl:value-of select="$href_1" /></xsl:attribute><![CDATA[]]>
							<xsl:value-of select="$caption" /><![CDATA[]]>
						</a>

					</xsl:when>
					<xsl:otherwise>
						<a target="_self">
							<xsl:attribute name="href">
<xsl:value-of
								select="'SuperXmlTabelle'" />
	<xsl:text>?</xsl:text><xsl:value-of select="$showNavigation"/><xsl:text>tid=</xsl:text><xsl:value-of select="$href_1" /></xsl:attribute><![CDATA[]]>
							<xsl:value-of select="$caption" /><![CDATA[]]>
						</a>

					</xsl:otherwise>
				</xsl:choose>
			</li>
		</xsl:if>
	</xsl:template>
</xsl:stylesheet>