请xml高手们,在xsl中能否引入xml???
如果能的话应该怎么实现???
[解决办法]
document( "otherxml.xml ")
[解决办法]
<xsl:param name= "lpfile " select= "aaa.xml "/>
之后就可以 <xsl:value-of select= "docment($lpfile)//greetings/Msg1 "/> 这个方法应用了。当然,引入多个XML要docment()多次,你可以使用多个xsl:param。
[解决办法]
<xsl:value-of select= "docment( 'aaa.xml ')//greetings/Msg1 "/>
[解决办法]
我挺佩服LZ,代码出了问题,却不懂从哪里查起,呵呵:
1.xml:
<?xml version= "1.0 " encoding= "UTF-8 "?>
<?xml-stylesheet type= "text/xsl " href= "aaa.xsl " ?>
<localizationpack>
<greetiongs>
<msg1> 你好 </msg1>
<msg1> 早上好 </msg1>
<msg1> 晚安 </msg1>
</greetiongs>
</localizationpack>
2.xml:
<?xml version= "1.0 " encoding= "UTF-8 "?>
<?xml-stylesheet type= "text/xsl "?>
<localizationpack>
<greetiongs>
<msg1> hello </msg1>
<msg1> good morning </msg1>
<msg1> good night </msg1>
</greetiongs>
</localizationpack>
aaa.xml:
<?xml version= "1.0 " encoding= "UTF-8 "?>
<xsl:stylesheet xmlns:xsl= "http://www.w3.org/1999/XSL/Transform " version= "1.0 ">
<xsl:param name= "lpfile " select= " '2.xml ' "/>
<xsl:template match= "/ ">
<html>
<body bgcolor= "#6a6dee " text= "#000000 ">
<p>
<xsl:value-of select= "document($lpfile)//greetiongs/msg1 "/>
</p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
把以上3个文件复制存盘后,双击1.XML运行可看到效果,希望LZ能看明白。