<?xml version="1.0" encoding="GB2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:newasp="#newasp-functions" exclude-result-prefixes="msxsl newasp">
<xsl:output method="xml" omit-xml-declaration = "yes" indent="yes" version="4.0"/>
	<!--
	Copyright (C) 2007,2008 NewAsp.Net. All rights reserved.
	Written by newasp.net Sunwin
	-->
<xsl:variable name="myscript">
<![CDATA[
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
	document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="'+swf_path+'images/pixviewer.swf"><param name="quality" value="high"><param name="bgcolor" value="#ffffff">');
	document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
	document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'&textcolor='+textcolor+'&borderstyle='+borderStyle+'&text_align='+text_align+'&interval_time='+interval_time+'&textsize='+text_size+'">');
	document.write('<embed src="'+swf_path+'images/pixviewer.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'&textcolor='+textcolor+'&borderstyle='+borderStyle+'&text_align='+text_align+'&interval_time='+interval_time+'&textsize='+text_size+'" menu="false" bgcolor="#ffffff" quality="high" width="'+ focus_width +'" height="'+ focus_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
]]>
</xsl:variable>
<xsl:variable name="showpixtitle">
	<xsl:choose>
		<xsl:when test="/xml/@select=0">0</xsl:when>
		<xsl:otherwise>22</xsl:otherwise>
	</xsl:choose>
</xsl:variable>
<xsl:template match="/">
	<script type="text/javascript">
	var interval_time = 5 ;	//间隔时间
	var focus_width = <xsl:value-of select="/xml/@width"/>;	//宽度
	var focus_height = <xsl:value-of select="/xml/@height"/>;	//高度
	var text_height = <xsl:value-of select="$showpixtitle" />;	//文本高度
	var textcolor = "#000000";	//文本颜色
	var text_align= 'center';	//文本对齐方式
	var text_size = 12;			//字体大小
	var borderStyle = "000|0x000000|000";	//边框样式
	var swf_path = '<xsl:value-of select="$installdir" />';	//swf文件路径
	focus_height = focus_height-text_height;
	var swf_height = focus_height+text_height

	
	var pics='<xsl:call-template name="pixfiles"/>';
	var links='<xsl:call-template name="pixlinks"/>';
	var texts='<xsl:call-template name="pixtexts"/>';
	pics=pics.substr(1,pics.length-1);
	texts=texts.substr(1,texts.length-1);
	links=links.substr(1,links.length-1);
	
	<xsl:value-of select="$myscript" disable-output-escaping="yes" />
	</script>
</xsl:template>
<xsl:template name="pixfiles">
	<xsl:for-each select="xml/datalist/row">|<xsl:value-of select="@imglink"/></xsl:for-each>
</xsl:template>
<xsl:template name="pixtexts">
	<xsl:for-each select="xml/datalist/row">|<xsl:choose>
		<xsl:when test="/xml/@length = 0"><xsl:value-of select="@title" /></xsl:when>
		<!--xsl:when test="string-length(@title) &gt; number(/xml/@length)"><xsl:value-of select="substring(@title,0,number(/xml/@length))" /></xsl:when-->
		<xsl:otherwise><xsl:value-of select="newasp:cutstring(string(@title),number(/xml/@length))" /></xsl:otherwise>
	</xsl:choose></xsl:for-each>
</xsl:template>
<xsl:template name="pixlinks">
	<xsl:for-each select="xml/datalist/row">|<xsl:value-of select="@link"/></xsl:for-each>
</xsl:template>
<msxsl:script language="VBScript" implements-prefix="newasp" xmlns:msxsl="urn:schemas-microsoft-com:xslt"><![CDATA[							
	Option Explicit
	
	Function removehtml(strValue)
		Dim re
		Set re = new RegExp
		re.IgnoreCase = True
		re.Global = True
		re.Pattern = "<(.[^>]*)>"
		strValue = re.Replace(strValue,"")
		Set re = Nothing
		removehtml = strValue
	End Function

	Function stringlength(strValue)
		Dim re
		Set re = new RegExp
		re.IgnoreCase = True
		re.Global = True
		re.Pattern = "[^\x00-\xff]"
		stringlength = Len(re.Replace(strValue,"aa"))
		Set re = Nothing
	End Function

	Function cutstring(str,strlen)
		Dim i,l,t,c,s
		l = Len(str)
		s = ""
		strlen = CLng(strlen)
		If strlen < 1 Then
			s = str
		Else
			t = 0
			For i = 1 To l
				c = Asc(Mid(str,i,1))
				If c < 1 Then
					t = t + 2
				Else
					t = t + 1
				End If
				If t >= strlen Then
					s = left(str,i)&""
					Exit for
				Else
					s = str
				End If
			Next
		End If
		cutstring = s
	End Function
]]>
</msxsl:script>
</xsl:stylesheet>