The Bodon Sky

my sky, my free, my .net , my wavelet
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

WinformControl 也能嵌入 xml 中

Posted on 2005-09-20 14:30  bodon  阅读(236)  评论(0)    收藏  举报

一次偶然的机会,我想既然 winform control 可以嵌入html中,以增强客户端的功能,
那么能否将其嵌入 xml中呢?

我本无意去实现它,可是后来发现了一个很好的例子,这个例子的存储采用的是xml方式,对我现在的项目很有利用价值,如果我能将winform control嵌入xml中,那么这个例子对我现在的项目的价值就更大了。于是开始写例子做测试,终于调试成功。

// test.xml 文件
<?xml version="1.0" encoding="GB2312" ?>
<?xml:stylesheet type="text/xsl" href="test.xsl"?>

<winformcontrols>
   <id>WinFormServerControl</id>
   <classid>WinFormIEControls.dll#WinFormIEControls.ServerControl</classid>
   <height>200px</height>
   <width>220px</width>
   <viewmode>VIEWASTEXT</viewmode>
</winformcontrols>

//test.xsl
<?xml version="1.0" encoding="GB2312" ?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
  <xsl:apply-templates select="winformcontrols" />
</xsl:template>
<xsl:template match="winformcontrols">
 <xsl:element name="object">
  <xsl:attribute name="id">
   <xsl:value-of select="id" />
  </xsl:attribute>
  <xsl:attribute name="classid">
   <xsl:value-of select="classid" />
  </xsl:attribute>
 </xsl:element>
</xsl:template>
</xsl:stylesheet>