<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output
		omit-xml-declaration="yes"
		method="xml"
		version="1.0"
		encoding="CP-1252"
		indent="yes"
		doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
		doctype-public="-//W3C//DTD XHTML 1.1//EN"
		/>
	<xsl:strip-space elements="*"/>
	<xsl:template match="/">
		<html xml:lang="it">
			<xsl:attribute name="xmlns">http://www.w3.org/1999/xhtml</xsl:attribute>
			<xsl:variable name="b" select="/shEdit/query/parametro[nome='b']/valore"/>
			<xsl:call-template name="head">
				<xsl:with-param name="title" select="'Home page'"/>
				<xsl:with-param name="css" select="100"/>
			</xsl:call-template>
			<body>
				<div class="container">
					<xsl:call-template name="header">
						<xsl:with-param name="b" select="$b"/>
						<xsl:with-param name="livelloI" select="0"/>
					</xsl:call-template>
					<xsl:call-template name="leftbar">
						<xsl:with-param name="b" select="$b"/>
					</xsl:call-template>
					<div class="ext-center t-space">
						<span id="content" />
						<xsl:variable name="url" select="concat($visxml,'?xx=100&amp;s=2&amp;v=9&amp;c=1448&amp;na=1&amp;n=1&amp;t=1&amp;b=',$b)"/>
						<xsl:call-template name="commento">
							<xsl:with-param name="str" select="$url"/>
						</xsl:call-template>
						<xsl:variable name="hp" select="document($url)"/>
						<xsl:for-each select="$hp/shEdit/Categoria/Categoria[idCategoria = 1449]/notizia[1]">
							<div class="ext-center ht-space">
								<img
									src="{corpo/immagine/url}"
									alt="{corpo/immagine/alt}"
									title="{corpo/immagine/alt}"
									class="home-img"/>
							</div>
							<div class="ext-center">
								<!--form action="http://opac.regione.sardegna.it/SebinaOpac/Opac" method="get" class="search-form2" target="_blank"-->
								<form action="http://opac.regione.sardegna.it/SebinaOpac/Opac" id="formsebina" method="get" class="search-form2">
									<div class="ext-center">
										<div class="ext-center t-space b-space">
										<label for="idtext" class="rosso f-bold f-size-tit">
											<!--div class="left"-->
											<img
												src="/img/cerca2.gif"
												class="left"
												alt="cerca un libro, una rivista, un film"/>
											<!--/div-->
										</label>
										<input type="hidden" name="action" value="search"/>
										<input type="text" id="idtext" name="LIBERA" value="inserisci testo" onfocus="this.value=''"/>
										<input id="idcerca" type="submit" value="cerca" accesskey="c"/>
										<a href="http://opac.regione.sardegna.it/SebinaOpac/Opac" class="link-ric" rel="blank">
											<xsl:text>ricerca avanzata</xsl:text>
										</a>
										</div>
									</div>
								</form>
								<!--
								<form action="http://www.sardegnabiblioteche.it/j/v/126?s=2&amp;v=9&amp;c=5179&amp;na=1&amp;n=10" method="post" class="search-form2">
									<div class="ext-center">
										<div class="ext-center t-space b-space">
										<label for="idtext" class="rosso f-bold f-size-tit">
											<div class="left">
											<img
												src="/img/cerca2.gif"
												alt="cerca un libro, una rivista, un film"/>
											</div>
										</label>
										<input type="hidden" name="action" value="search"/>
										<input type="text" id="idtext" name="LIBERA" value="inserisci testo" onfocus="this.value=''"/>
										<input id="idcerca" type="submit" value="cerca" accesskey="c"/>
										<a href="http://www.sardegnabiblioteche.it/j/v/126?s=2&amp;v=9&amp;c=5179&amp;na=1&amp;n=10" class="link-ric">
											<xsl:text>ricerca avanzata</xsl:text>
										</a>
										</div>
									</div>
								</form>
								-->
							</div>
							<div class="ext-center t-space">
								<xsl:value-of select="breve/testo"/>
							</div>
						</xsl:for-each>
						<div class="ext-center t-space">
							<div class="column r-space">
								<xsl:call-template name="box">
									<xsl:with-param name="cat" select="$hp/shEdit/Categoria"/>
									<xsl:with-param name="idcat" select="1450"/>
									<xsl:with-param name="b" select="$b"/>
								</xsl:call-template>
							</div>
							<div class="column r-space">
								<xsl:call-template name="box">
									<xsl:with-param name="cat" select="$hp/shEdit/Categoria"/>
									<xsl:with-param name="idcat" select="1451"/>
									<xsl:with-param name="b" select="$b"/>
								</xsl:call-template>
							</div>
							<div class="column">
								<xsl:call-template name="box">
									<xsl:with-param name="cat" select="$hp/shEdit/Categoria"/>
									<xsl:with-param name="idcat" select="1452"/>
									<xsl:with-param name="b" select="$b"/>
								</xsl:call-template>
							</div>
						</div>
					</div>
					<xsl:call-template name="footer">
						<xsl:with-param name="b" select="$b"/>
						<xsl:with-param name="query" select="/shEdit/query"/>
					</xsl:call-template>
				</div>
			</body>
		</html>
	</xsl:template>
	<xsl:template name="box">
		<xsl:param name="cat"/>
		<xsl:param name="idcat"/>
		<xsl:param name="b"/>
		<xsl:for-each select="$cat/Categoria[idCategoria = $idcat]/notizia[1]">
			<xsl:variable name="idc">
				<xsl:if test="corpo/url">
					<xsl:if test="contains(corpo/url,'&amp;c=')">
						<xsl:if test="contains(substring-after(corpo/url,'&amp;c='),'&amp;')">
							<xsl:value-of select="substring-before(substring-after(corpo/url,'&amp;c='),'&amp;')"/>
						</xsl:if>
						<xsl:if test="not(contains(substring-after(corpo/url,'&amp;c='),'&amp;'))">
							<xsl:value-of select="substring-after(corpo/url,'&amp;c=')"/>
						</xsl:if>
					</xsl:if>
				</xsl:if>
			</xsl:variable>
			<xsl:if test="categorie/cat/id != $idcat or categorie/cat/id = $idc">
				<xsl:if test="categorie/cat/id = $idc">
					<xsl:call-template name="toupper">
						<xsl:with-param name="toconvert" select="categorie/cat[id = $idc]/nome"/>
					</xsl:call-template>
				</xsl:if>
				<xsl:if test="not(categorie/cat/id = $idc)">
					<xsl:call-template name="toupper">
						<xsl:with-param name="toconvert" select="categorie/cat[id != $idcat]/nome"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:if>
			<xsl:if test="not(categorie/cat/id != $idcat or categorie/cat/id = $idc)">
				<xsl:variable name="albero" select="document(concat($XMLPath,'/getalberocat.php?id=',$idc))"/>
				<xsl:call-template name="toupper">
					<xsl:with-param name="toconvert" select="$albero/albero/categoria[position() = last()]/cat_nome"/>
				</xsl:call-template>
			</xsl:if>
			<br/>
			<xsl:if test="corpo/immagine/thumbnail != ''">
				<img
					src="{corpo/immagine/thumbnail}"
					alt="{corpo/immagine/alt}"
					title="{corpo/immagine/alt}"
					class="thumbnail"/>
			</xsl:if>
			<a class="f-bold">
				<xsl:call-template name="CreaLink">
					<xsl:with-param name="urldinamico" select="corpo/url"/>
					<xsl:with-param name="idNotizia" select="idNotizia"/>
					<xsl:with-param name="flusso" select="2"/>
					<xsl:with-param name="t" select="1"/>
					<xsl:with-param name="xsl" select="110"/>
					<xsl:with-param name="idCategoria" select="../idCategoria"/>
					<xsl:with-param name="b" select="$b"/>
				</xsl:call-template>
				<xsl:value-of select="titolo/testo"/>
			</a>
			<xsl:text> </xsl:text>
			<xsl:value-of select="breve/testo"/>
		</xsl:for-each>
	</xsl:template>
	<xsl:template name="leftbar">
		<xsl:param name="b"/>
		<xsl:variable name="a">
			<xsl:value-of select="/shEdit/query/parametro[nome = 'a']/valore"/>
		</xsl:variable>
		<!--xsl:variable name="url" select="concat($XMLPath,'/appuntamenti2.php?a=',$a,'&amp;b=',$b)"/-->
		<xsl:variable name="url" select="concat($visxml,'?xx=100&amp;s=2&amp;v=9&amp;c=1445&amp;na=1&amp;n=3&amp;c1=1650')"/>
		<xsl:comment>
			<xsl:value-of select="$url"/>
		</xsl:comment>
		<xsl:variable name="app" select="document($url)"/>
		<xsl:variable name="nntz">
			<xsl:value-of select="4 - count($app/shEdit/Categoria/notizia)"/>
		</xsl:variable>
		<xsl:variable name="url2" select="concat($visxml,'?xx=100&amp;s=2&amp;v=9&amp;c=1444&amp;na=1&amp;n=4&amp;c1=1650')"/>
		<xsl:comment>
			<xsl:value-of select="$url2"/>
		</xsl:comment>
		<xsl:variable name="ntz" select="document($url2)"/>
		<div class="menu-left t-space r-space">
			<ul>
				<!-- notizie -->
				<xsl:for-each select="$ntz/shEdit/Categoria">
					<li>
						<div class="column">
							<a>
								<xsl:call-template name="CreaLink">
									<xsl:with-param name="urldinamico" select="urldim"/>
									<xsl:with-param name="b" select="$b"/>
								</xsl:call-template>
								<xsl:if test="not(immaginecat)">
									<xsl:attribute name="class">topvoci</xsl:attribute>
									<xsl:call-template name="toupper">
										<xsl:with-param name="toconvert" select="nomeCategoria"/>
									</xsl:call-template>
								</xsl:if>
								<img
									src="{immaginecat/url}"
									alt="{immaginecat/alt}"
									title="{immaginecat/alt}">
									<xsl:attribute name="class">
										<xsl:value-of select="'g-dim space-icon'"/>
									</xsl:attribute>
								</img>
							</a>
						</div>
						<ul>
							<xsl:for-each select="notizia[position() &lt;= $nntz]">
								<li>
									<div>
										<xsl:attribute name="class">
											<xsl:value-of select="'column'"/>
											<xsl:if test="(position() != last()) or $app/shEdit/Categoria/notizia">
												<xsl:value-of select="' half-lined'"/>
											</xsl:if>
										</xsl:attribute>
										<a>
											<xsl:call-template name="CreaLink">
												<xsl:with-param name="idNotizia" select="idNotizia"/>
												<xsl:with-param name="flusso" select="2"/>
												<xsl:with-param name="t" select="1"/>
												<xsl:with-param name="xsl" select="110"/>
												<xsl:with-param name="idCategoria" select="../idCategoria"/>
												<xsl:with-param name="b" select="$b"/>
											</xsl:call-template>
											<span class="f-bold">
												<xsl:value-of select="titolo/testo"/>
											</span>
										</a>
										<xsl:if test="breve/testo != ''">
											<xsl:text> - </xsl:text>
											<xsl:value-of select="breve/testo"/>
										</xsl:if>
									</div>
									<xsl:if test="$nntz = 4">
										<div class="column">
											<br/>
										</div>
									</xsl:if>
								</li>
							</xsl:for-each>
						</ul>
					</li>
				</xsl:for-each>
				<!-- appuntamenti -->
				<xsl:if test="$app/shEdit/Categoria/notizia">
					<xsl:for-each select="$app/shEdit/Categoria">
						<li>
							<div class="column">
								<a>
									<xsl:call-template name="CreaLink">
										<xsl:with-param name="urldinamico" select="urldim"/>
										<xsl:with-param name="b" select="$b"/>
									</xsl:call-template>
									<xsl:if test="not(immaginecat)">
										<xsl:attribute name="class">topvoci</xsl:attribute>
										<xsl:call-template name="toupper">
											<xsl:with-param name="toconvert" select="nomeCategoria"/>
										</xsl:call-template>
									</xsl:if>
									<img
										src="{immaginecat/url}"
										alt="{immaginecat/alt}"
										title="{immaginecat/alt}">
										<xsl:attribute name="class">
											<xsl:value-of select="'g-dim space-icon-s'"/>
										</xsl:attribute>
									</img>
								</a>
							</div>
							<ul>
								<xsl:for-each select="notizia[position() &lt;= 4]">
									<li>
										<div>
											<xsl:attribute name="class">
												<xsl:value-of select="'column'"/>
												<xsl:if test="position() != last()">
													<xsl:value-of select="' half-lined'"/>
												</xsl:if>
											</xsl:attribute>
											<a>
												<xsl:call-template name="CreaLink">
													<xsl:with-param name="idNotizia" select="idNotizia"/>
													<xsl:with-param name="flusso" select="2"/>
													<xsl:with-param name="t" select="1"/>
													<xsl:with-param name="xsl" select="110"/>
													<xsl:with-param name="idCategoria" select="../idCategoria"/>
													<xsl:with-param name="b" select="$b"/>
												</xsl:call-template>
												<span class="f-bold">
													<xsl:value-of select="titolo/testo"/>
												</span>
											</a>
											<xsl:if test="breve/testo != ''">
												<xsl:text> - </xsl:text>
												<xsl:value-of select="breve/testo"/>
											</xsl:if>
										</div>
									</li>
								</xsl:for-each>
							</ul>
						</li>
					</xsl:for-each>
				</xsl:if>
			</ul>
		</div>
	</xsl:template>
	<!-- include -->
	<xsl:include href="/xsl/xsl_104.xsl"/>
	<!-- head -->
	<xsl:include href="/xsl/xsl_102.xsl"/>
	<!-- header -->
	<xsl:include href="/xsl/xsl_101.xsl"/>
	<!-- funzioni -->
	<xsl:include href="/xsl/xsl_103.xsl"/>
	<!-- footer -->
	<xsl:include href="/xsl/xsl_105.xsl"/>
</xsl:stylesheet>

