[阅读: 446] 2004-10-31 15:59:30
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,
你去掉就可以了