文章分类 | 软件分类 | 最新软件 | 杀毒软件 | 实用软件  | MTV下载  | 设为首页 |
  | 下载分类 | 最近更新
您的位置: 首页 >> 文章首页 >> 技术开发 >> XML 学院 >>  
XML 学院点击TOP10
·了解WEB页面工具语言XML五好处2006-2-9 16:29:48
·使用PHP DOM-XML创建和解析XML文件2006-2-5 14:16:30
·XML在语音合成中的应用2006-2-9 16:36:32
·制作虚线效果的水平线2006-2-10 11:43:03
·XML简易教程之三2006-2-9 16:30:35
·XSL简明教程5XSL的索引2006-2-9 16:29:31
·ADO数据与XML数据间的转换的类2006-2-9 16:29:15
·XSL简明教程2XSL转换2006-2-9 16:29:27
·为何XML对Web服务很重要2006-2-9 16:33:56
·使用xmldom在服务器端生成静态html页面2006-2-9 16:30:29
技术开发点击TOP10
·数据库升迁从sqlserver6.5到sqlserver20002006-2-9 17:36:12
·ASP生成JS调用的代码2006-2-9 9:06:53
·彻底终结浏览器Cahce页面的解决方案2006-2-5 13:31:26
·Javascript实例教程20 OLE Automation72006-2-9 16:53:32
·有关微软新一代开发技术ASP+的介绍2006-2-5 13:30:03
·MySQL Join详解2006-2-9 16:57:36
·ASP 中 Split 函数的实例2006-2-9 17:32:00
·使用视图控制用户对数据访问2006-2-9 17:33:51
·SQL Server 2000安装和基本框架2006-2-9 17:34:09
·怎样才能实现随机广告2006-2-5 13:19:42

 

用XsltArgumentList实现xsl的参数调用
作者:我去下载           时间:2006-2-10 11:47:19


XmlDocument XmlDoc=new XmlDocument();
    XmlDoc.Load(strFilePath);

    XslTransform xslt = new XslTransform();
    xslt.Load(strXslPath);

    XsltArgumentList xslArg = new XsltArgumentList();
    xslArg.AddParam("Key1", "",IXPath);
    xslArg.AddParam("Path", "",strPath);

    StringBuilder sb = new StringBuilder("");
    StringWriter sw = new StringWriter(sb);
    XmlTextWriter writer = new XmlTextWriter(sw);
    xslt.Transform(XmlDoc,xslArg,writer,null);
    writer.Close();
    HXML.InnerHtml=sb.ToString();

这是xsl文件

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 <xsl:param name="Key1"/>
 <xsl:param name="Path"/>
 <xsl:template match="/">
  <xsl:apply-templates select="/DB/L[@Key=$Key1]" />
 </xsl:template>
 
 <xsl:template  match="L[@Type='1']">
  <a target="_blank">
   <xsl:attribute name="href"><xsl:value-of select="@Link" /></xsl:attribute>
   <img border="0">
    <xsl:attribute name="width"><xsl:value-of select="@width" /></xsl:attribute>
    <xsl:attribute name="height"><xsl:value-of select="@height" /></xsl:attribute>   
    <xsl:attribute name="src"><xsl:value-of select="$Path" />Res/AD/<xsl:value-of select="@File" /></xsl:attribute>
   </img>  
  </a>
 </xsl:template>
 
 <xsl:template  match="L[@Type='2']">
   <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" >
    <xsl:attribute name="width"><xsl:value-of select="@width" /></xsl:attribute>
    <xsl:attribute name="height"><xsl:value-of select="@height" /></xsl:attribute>   
    <param name="movie"><xsl:attribute name="value"><xsl:value-of select="$Path" />Res/AD/<xsl:value-of select="@File" /></xsl:attribute></param>
    <param name="quality" value="high"/>
    <embed quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash">
     <xsl:attribute name="width"><xsl:value-of select="@width" /></xsl:attribute>
     <xsl:attribute name="height"><xsl:value-of select="@height" /></xsl:attribute>   
     <xsl:attribute name="src"><xsl:value-of select="$Path" />Res/AD/<xsl:value-of select="@File" /></xsl:attribute>   
    </embed>
   </object>
 </xsl:template>
 
</xsl:stylesheet>

xml文件

<?xml version="1.0" encoding="GB2312"?>
<DB>
  <L Name="测试1" height="100" width="100" Link="http://www.123.com" File="20056171345164340.gif" Key="200561713451653143405" Type="1" />
</DB>

分页:
相关文章:
Copyright© 2005-2006 wqxz.com, All Rights Reserved. 购买虚拟主机请与本站联系