-
最新日志
存档页
- 2010年08月
- 2010年07月
- 2010年06月
- 2010年05月
- 2010年04月
- 2010年03月
- 2010年02月
- 2010年01月
- 2009年12月
- 2009年11月
- 2009年10月
- 2009年09月
- 2009年08月
- 2009年06月
- 2009年03月
- 2009年01月
- 2008年12月
- 2008年10月
- 2008年09月
- 2008年08月
- 2008年07月
- 2008年06月
- 2008年05月
- 2008年04月
- 2008年03月
- 2008年02月
- 2008年01月
- 2007年12月
- 2007年11月
- 2007年10月
- 2007年09月
- 2007年08月
- 2007年07月
- 2007年06月
- 2007年05月
- 2007年04月
- 2007年03月
- 2007年02月
- 2007年01月
- 2006年12月
- 2006年11月
- 2006年10月
- 2006年09月
- 2006年08月
- 2006年07月
- 2006年06月
- 2006年05月
- 2006年04月
- 2006年03月
- 2006年02月
- 2006年01月
- 2005年12月
- 2005年11月
- 2005年10月
- 2005年09月
- 2005年08月
- 2005年07月
- 2005年06月
- 2005年05月
- 2005年04月
分类
功能
Category Archives: Xml/Xslt
又是广告转换程序
星期四 天气:晴 今天上午集团组织体检了. 这些天做的,留个念想. 先上xml结构,这个是从数据获取的两个DataSet合并生成的. <?xml version="1.0" encoding="gb2312"?><?xml-stylesheet type="text/xsl" href="newwindow.xslt"?><NewDataSet> <Table> <iPositionID>1</iPositionID> <cImageUrl>/img/1.jpg</cImageUrl> <cDefaultText>最新广告</cDefaultText> <iCycle>0.1</iCycle> <iHeightSize>600</iHeightSize> <iWidthSize>800</iWidthSize> <!–0随机,1轮循–> <iDisplayType>1</iDisplayType> <gAttach>WV0IHZlcnNpb249IKbWF0Y2g9Iip8dGV4dCgpIjlZXQ+DQoNCiAg</gAttach> </Table> <Table> <iADItemID>1</iADItemID> <cFileName>金镶玉2.jpg</cFileName> <cFileType>image/jpg</cFileType> <cLink>/map.aspx</cLink> <cTitle>中llll国</cTitle> </Table> <Table> <iADItemID>3</iADItemID> <cFileUrl>/img/pic-test-003.gif</cFileUrl> <cFileType>image/jpg</cFileType> <cLink>/Login.aspx</cLink> <cTitle>中国</cTitle> </Table> <Table> <iADItemID>4</iADItemID> <cFileUrl>/img/1.swf</cFileUrl> <cFileType>application/x-shockwave-flash</cFileType> <cTitle>Flash1</cTitle> </Table> <Table> <iADItemID>5</iADItemID> <cFileUrl>/img/4.swf</cFileUrl> <cFileType>application/x-shockwave-flash</cFileType> <cLink></cLink> <cTitle>Flash2</cTitle> </Table> <Table> <iADItemID>6</iADItemID> <cLink>/map.aspx</cLink> <cTitle>Flash2</cTitle> </Table> <!—-></NewDataSet> 这几个是转换程序,个个都有一身好武艺. Comm.xslt<?xml version="1.0" encoding="UTF-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:dyens="http://localhost/"> <msxsl:script implements-prefix="dyens" language="javascript"> <![CDATA[ function GetRandomInt(iNum) { return Math.floor(Math.random() * (iNum + 1) ); } ]]> </msxsl:script> <!– <msxsl:script implements-prefix="dyens" language="CSharp"> <![CDATA[ public int GetRandomInt_CSharp(iNum) { return new Random().Next(0,iNum); } ]]> </msxsl:script> –></xsl:stylesheet>SimpleText.xslt<?xml version="1.0" encoding="gb2312" ?><xsl:stylesheet … 繼續閱讀
节点集与结果树片断
承清一下它们的分别: 节点集是xslt内部的一种类型,可以在样式表中直接以$var变量的方式引用. 而后者需要用例如:msxsl:node-set 函数使您能够将结果树片段转换成节点集,以这样的方式引用msxsl:node-set($var)/book. 它是非xpath数据类型(string,number,boolean,node-set).
增强的广告飘浮与定位广告.
n久以前的 样式表 <?xml version="1.0" encoding="GB2312"?><!–作者:杨林 at 2005-08-?? –><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <xsl:template match="/Config"> <xsl:if test="AD/FloatType[.=1][../Enabled='true']"> <xsl:call-template name="getCodeOfFloat"/> </xsl:if> <xsl:if test="AD/FloatType[.=2][../Enabled='true']"> <xsl:call-template name="getCodeOfPosition"/> </xsl:if> <script language="javascript"> <xsl:for-each select="AD"> <xsl:if test="Enabled and not(Enabled=’false’)"> <xsl:variable name="linkAddr"> <xsl:choose> <xsl:when test="LimitTime/TimeSlice and LimitTime/TimeSlice/BeginTime and LimitTime/TimeSlice/BeginTime!=” and LimitTime/TimeSlice/EndTime!=”">/Frame/FloatAD/FloatControl.aspx?id=<xsl:value-of select="./Id" /></xsl:when> <xsl:otherwise> <xsl:value-of select="LinkAddr"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:call-template name="runCode"> <xsl:with-param name="photoURL" select="PhotoURL"/> <xsl:with-param name="fileType" select="FileType"/> <xsl:with-param name="photoHeight" select="PhotoHeight"/> <xsl:with-param name="photoWidth" … 繼續閱讀
增强的轮播广告
06年的货了 样式表 <?xml version="1.0" encoding="GB2312" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <xsl:template match="/"> <img src="{Advertisements/Ad[position()=1]/ImageUrl}" id="imgAd" style="cursor:hand;FILTER: revealTrans(Duration=3.0,Transition=1)"/> <xsl:value-of select="document(”)/*/node()[@name='ScriptData']/node()" disable-output-escaping="yes"/> <script language="JavaScript"> <xsl:apply-templates/> </script> </xsl:template> <xsl:template match="Advertisements"> <xsl:variable name="ads" select="Ad[Disabled = 'false']"/> <xsl:variable name="ads_count" select="count($ads)"/> var oAD = new Array(<xsl:value-of select="$ads_count"/>); var iADCount = <xsl:value-of select="$ads_count"/> <xsl:for-each select="$ads"> <xsl:if test="Type=’image’"> oAD[<xsl:value-of select="position()-1"/>] = new Object(); oAD[<xsl:value-of select="position()-1"/>].Type … 繼續閱讀
自由线程FreeThreadDOMDocument
星期二 天气:晴 昨天燕子 自己去五爱了 给我买了一堆袜子 给妈买了一双鞋 给自己买了一件 红色的内衣服 挺好看的 在市场买了一碗麻辣烫 买了二斤香樵 一般是用在多线程中的,不过现在好像用不到了这种对象了 除非你还在用asp来写后台程序、或者用 vb、vc之类com组件编程。 function Test(){ var xmlDom = new ActiveXObject("Msxml2.DOMDocument"); xmlDom.async = false; xmlDom.loadXML(…); if(xmlDom.parseError.errorCode != 0){ var myErr = xmlDom.parseError; alert("XML 加载错误: " + myErr.reason); }else{ var xslt = new ActiveXObject("Msxml2.XSLTemplate"); var xsltDom = new ActiveXObject("Msxml2.FreeThreadedDOMDocument"); xsltDom.async = false; xsltDom.load("??.xslt"); if(xsltDom.parseError.errorCode != 0) { var myErr = xsltDom.parseError; alert("XSLT … 繼續閱讀
定点广告与漂浮广告
配置文件 XML 内容 <?xml version="1.0" encoding="GB2312"?> <Config> <AD> <!–是否可用–> <Enabled>true</Enabled> <!–浮动类型1为随机浮动,2为定点浮动–> <FloatType>1</FloatType> <!–文件类型包括swf,或(image)各种web支持的图片格式,图片格式不用设置高度,宽度–> <FileType>swf</FileType> <PhotoURL>http://image2.sina.com.cn/dy/ad/cmad120x250a.swf</PhotoURL> <LinkAddr>http://user.7host.com/ioriwellings/</LinkAddr> <PopupHeight></PopupHeight> <PopupWidth></PopupWidth> <PhotoTop>100</PhotoTop> <PhotoLeft>20</PhotoLeft> <PhotoHeight>250</PhotoHeight> <PhotoWidth>120</PhotoWidth> </AD> <AD> <!–是否可用–> <Enabled>true</Enabled> <!–浮动类型1为随机浮动,2为定点浮动–> <FloatType>2</FloatType> <!–文件类型包括swf,或(image)各种web支持的图片格式,图片格式不用设置高度,宽度–> <FileType>image</FileType> <PhotoURL>http://www.sanhaostreet.com/imagesindex/indexnew_shop.jpg</PhotoURL> <LinkAddr>http://user.7host.com/ioriwellings/</LinkAddr> <PopupHeight>250</PopupHeight> <PopupWidth>120</PopupWidth> <PhotoTop>100</PhotoTop> <PhotoLeft>20</PhotoLeft> <PhotoHeight>90</PhotoHeight> <PhotoWidth>90</PhotoWidth> </AD> <AD> <!–是否可用–> <Enabled>true</Enabled> <!–浮动类型1为随机浮动,2为定点浮动–> <FloatType>1</FloatType> … 繼續閱讀
转我的留言板一页
JavaX 作者 主题: 设计模式:递归与分组 八神[过客] 发表于: 8/25/2005 1:34:55 AM 递归: 编写一个递归模板,将整个列表作为参数传给它.如果列表不为空,则处理它的第一项,然后递归调用自身来处理列表除第一项以外的其余部分. 例子: 计算总销售额 数据文件 <booklist> <book> <title>Angela’s Ashes</title> <author>Frank McCourt</author> <publisher>HarperCollins</publisher> <isbn>0 00 649840 X</isbn> <price>6.99</price> <sales>235</sales> </book> <book> <title>Sword of Honour</title> <author>Evelyn Waugh</author> <publisher>Penguin Books</publisher> <isbn>0 14 018967 X</isbn> <price>12.99</price> <sales>12</sales> </book> </booklist> 样式表 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template name="total-sales-value"> <xsl:param name="list"/> <xsl:choose> <xsl:when test="$list"> <xsl:variable name="first" select="$list[1]"/> <xsl:variable name="total-of-rest"> <xsl:call-templates name="total-sales-value"> … 繼續閱讀
广告轮播
将以前的一段脚本 改成组件了 XSLT 文件 AdRotator.xslt <?xml version="1.0" encoding="GB2312" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <xsl:template match="/"> <img src="{Advertisements/Ad[position()=1]/ImageUrl}" id="imgAd" style="cursor:hand;FILTER: revealTrans(Duration=3.0,Transition=1)"/> <xsl:value-of select="document(”)/*/node()[@name='ScriptData']/node()" disable-output-escaping="yes"/> <script language="JavaScript"> <xsl:apply-templates/> </script> </xsl:template> <xsl:template match="Advertisements"> var myImages = new Array(<xsl:value-of select="count(Ad)"/>); <xsl:for-each select="Ad"> myImages[<xsl:value-of select="position()-1"/>] = new Image(); myImages[<xsl:value-of select="position()-1"/>].src = "<xsl:value-of select="ImageUrl"/>" myImages[<xsl:value-of select="position()-1"/>].onclick = function(){ window.open(‘<xsl:value-of select="NavigateUrl"/>’,”,’left=0,top=0,height=<xsl:value-of … 繼續閱讀