中国开发网: 论坛: 程序员情感CBD: 贴子 39963
有狐: 试试这样可以吗
msg.xml

<?xml version="1.0" encoding="GB2312"?>
<?xml-stylesheet type="text/xsl" href="msg.xsl"?>
<msglist>
<msg MID="252598634755378201" GId="1001">
<Sid>L001255</Sid>
<Content>测试</Content>
</msg>
</msglist>
<!--
目标格式:
<protocol>
<MID>252598634755378201</MID>
<GID>1001</GID>
<SID>L001255</SID>
<Content>测试</Content>
</protocol>
-->


msg.xsl

<?xml version="1.0" encoding="GB2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/msglist/msg">
<textarea cols="120" rows="20">
<protocol>
<MID><xsl:value-of select="@MID"/></MID>
<GID><xsl:value-of select="@GId"/></GID>
<SID><xsl:value-of select="Sid"/></SID>
<Content><xsl:value-of select="Content"/></Content>
</protocol>
</textarea>
</xsl:template>

</xsl:stylesheet>


我的机器IE不知道怎么回事,显示不了转换结果,所以我加了textarea,
你去掉就可以了

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录