正 文

针对不可访问 Web 页的文本选择


www.7dspace.com  更新日期:2005-10-4 12:28:45  七度空间


最后,示例 3 中提供的代码基于显示格式确定执行转换。

代码示例 3. 转换页面显示

//load the Xml doc
      XmlDocument myXmlDoc = new XmlDocument();
      myXmlDoc.Load(sXmlPath);

      //load the Xsl doc
      XslTransform myXslTrans = new XslTransform();
      myXslTrans.Load(sXslPath);

      //do the actual transform of Xml
      myXslTrans.Transform(myXmlDoc,args, Response.OutputStream);
   }
   catch(Exception e)
   {
      string msgError = "Exception: ";
      Response.Write(msgError + e.Message);
   }
}
static string version = "";
</script>

显示结果

本节包括来自一个 XML 源文档的示例、两个执行两个转换的 XSLT,以及两组结果(一个是富内容版本,另一个是纯文本版本)。

代码示例 4. 源 XML

<table border="5" cellpadding="5" cellspacing="5" bordercolor="#ffffff"
bgcolor="#ff9900" width="75">
   <tr>
      <td width="70">
         <img border="0" src="/enable/images/photos/man.jpg"
width="70" height="70" alt="Man with laptop"/>
      </td>
   </tr>
   <tr>
      <td width="70">
         <img src="images/photos/hand.jpg" width="70" height="70"
border="0" alt="Hand on keyboard"/>
      </td>
   </tr>
   <tr>
      <td width="70" align="middle">
         <img src="images/photos/braille_fingers.gif" width="65"
height="91" valign="absmiddle" alt="Fingers feeling Braille text"
border="0"/>
      </td>
   </tr>
</table>
5页,页码:[1] [2] [3] [4] [5] 

上一篇:SQL Server 本机 Web 服务的使用方案
下一篇:ASP.NET Starter Kit 入门指南
作者:  来源:MSDN ( 责任编辑:7dspace )
收藏此页】【打印】【关闭
站 内 搜 索
 

热 点 导 读
特 别 推 荐