国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

用XsltArgumentList實現xsl的參數調用

2019-11-18 19:15:57
字體:
來源:轉載
供稿:網友

選擇自 hstod 的 Blog

    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=" <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="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="</DB>


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 沾益县| 武山县| 闸北区| 北川| 南皮县| 连平县| 定兴县| 临颍县| 海城市| 梓潼县| 海盐县| 长沙县| 延边| 镇赉县| 金坛市| 盱眙县| 丰镇市| 军事| 崇礼县| 墨脱县| 和龙市| 合作市| 永春县| 谢通门县| 卢氏县| 株洲市| 蒙山县| 克拉玛依市| 绵阳市| 阳东县| 宁津县| 斗六市| 古交市| 沽源县| 策勒县| 钦州市| 穆棱市| 丰都县| 游戏| 武山县| 措美县|