xslÓëxmlµÄÎÊÌâ
ÇëÎÊ´ó¼Ò£º
Ò»¸öXMLÎļþÈçºÎÓöà¸öÑùʽ»¯Îļþ£¨xsl£©Ñùʽ°¡£¿
ÄãÏëÎÊ:Ò»·Ýa.xml×îÖտɼûµÄÑùʽÓÐb.xml(ÓÃb.xsl¸ñʽ),c.xml(ÓÃc.xsl¸ñʽ)
»¹ÊÇ:Ò»·Ýa.xml×îÖÕµÄÑùʽÊÇd.xml(ÓÃb.xsl¸ñʽһ²¿·Ö,ÓÃc.xsl¸ñʽÁíÒ»²¿·Ö)
ÎÒµÄÒâ˼ÊÇa.xmlÈçºÎÔÚ²»Í¬µÄÇé¿öÏÂÁ´½Ó²»Ò»ÑùµÄÑùʽÎļþ(¼´b.xsl;c.xsl)£¬¼´ÎÒÏëÓöà¸öxslÈ¥¶ÁÒ»¸öxml¡£
²»ÊÇÒ»¸ö¶à¸öxml ÓÃÒ»¸ö¹«ÓõÄxslÓ´
¶à¸öxslÈ¥¶ÁÒ»¸öxml
re:
ûÓÐÕâÑùµÄ!ÎÒµÄÒâ˼ÊÇÎÊÄã:×îÖÕÏÔʾµÄÑù×Ó,ÊÇÒ»·ÝXML¶ÔÈÎÒ»Ò»·Ýxsl(1:1)»¹ÊÇÒ»·Ýxml¶ÔN·Ýxsl(1:n)
Ò»·Ýxml¶ÔÓ¦¶à·ÝxslµÄ»°£¬ÓÐÁ½ÖÖ·½Ê½
1.Ð޸ĸù¾Ý²»Í¬µÄÕ¹ÏÖ·½Ê½£¬ÐÞ¸ÄxmlÖйØÓÚxslµÄÒýÓã¬ÓÉä¯ÀÀÆ÷¸ù¾ÝxslÈ¥½âÎöxmlÉú³É½çÃæ
2.Ð޸ĸù¾Ý²»Í¬µÄÕ¹ÏÖ·½Ê½£¬ÓɳÌÐòȥѡÓò»Í¬µÄxslÈ¥½âÎöxml£¬²¢Éú³É½çÃæ
¶÷,Kaleon ˵µÄÓеÀÀí£¬µ«¾ßÌåÔõôʵÏÖ°¢£¿
»¹ÓÐÎÒÏëa.xml µÄÊý¾ÝÓÃb.xsl³ÊÏÖÒ»²¿·Ö£¬¶øÏëͨb.xsl½«Õⲿ·ÖÁ´½Óµ½ÁíÒ»¸öÒ³Ãæ½øÐÐÏêϸÏÔʾ£¿
Èç:a.xml
<?xml version="1.0">
<r>
<b>
<name>name1 </name>
<content>content¡¡ </content>
</b>
</r>
¶ø b.xsl
<xsl:for-each select="//b">
<a href="µØÖ·"> <strong> <xsl:value-of select="name" </strong> </a>
</xsl:for-each>
¶ø"µØÖ·"ÊÇÏëÁ´½Óµ½ÁíÒ»¸öÒ³Ãæ(html,xsl)Îļþ£¬ÏÔʾÏêϸÐÅÏ¢£¬
ÎÒÖªµÀx-link, x-pointerµ«²âÊÔû³É¹¦£¬²»ÏëÓÃjavascriptÔٴμÓÔØxmlµ½ÄÚ´æÉÏ£
Ïà¹ØÎÊ´ð£º
DataSetµ¼³öxml Åú´¦Àí(Ñ»·)µÃÔõô´¦Àí
XMLÎļþ
<A>
<B>
<C>
</C>
&nb ......
ÎÒÔÚʹÓÃDom¶ÁxmlÎļþʱÓöµ½Ò»¸öÎÊÌ⣬¾ÍÊǵ±123.xmlÎļþ²»´æÔÚʱ£¬load(123.xml)¾Í±¨´í£¬ÔõôÑù²ÅÄÜÅжÏÕâ¸öÎļþÊÇ·ñ´æÔÚ°¡£¬ÎÒÒªµÄÊÇ´æÔÚʱ¾Í¶ÁÈ¡£¬²»´æÔÚ¾ÍÌø¹ý£¬¼ÌÐøµÄ¶ÁÏÂÒ»¸öxml£¬Çë½Ì¸÷λ´óÏÀ£¬
$file ......
ÈçºÎ¶ÔxmlÄÚÈÝÊý¾Ý½øÐбȽÏ
ÀýÈ磺
<?xml version='1.0' encoding='utf-8'?>
<TestLIST>
<PID>40</PID>
<TestName>ÉîÛÚÊÐ</TestName>
......
Java code:
/**
* ÉèÖÃÖ¸¶¨µÄÔªËØÃûºÍ½ÚµãË÷ÒýËù¶ÔÓ¦½ÚµãµÄÄÚÈÝ
* @param ÔªËØÃû
* @param ½ÚµãË÷Òý
* @param ÄÚÈÝ
*/
public void setElementContent(String elementName,in ......
ä¯ÀÀÆ÷IE6
ÔÚÒ»¸öÒ³ÃæÖÐÓÐÒ»¸öÁ¬½Ó£¬Á¬½ÓµÄÒ³ÃæÄÚÈÝÈçÏ£º
<%@ page contentType="text/xml; charset=UTF-8" language="java"%>
<?xml version="1.0" encoding=& ......