Dear all,
I have problems in using apply-templates
<!-- xml soure file bible01.xml-->
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="bible01_01.xsl"?>
<PERIODIC_TABLE>
<MARCO>
Display this.
<abc>polo</abc>
</MARCO>
<ATOM STATE="GAS">
<MELTING_POINT UNITS="Kelvin">0.95</MELTING_POINT>
<DENSITY UNITS="grams/cubic centimeter">0.0001785</DENSITY>
</ATOM>
</PERIODIC_TABLE>
//----------------------------------------------------------
//----------------------------------------------------------
<!-- xslt file bible01_01.xsl-->
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/PERIODIC_TABLE/MARCO">
<html>
<xsl:apply-templates/>
</html>
</xsl:template>
</xsl:stylesheet>
I use Xalan to process the two files.
java org.apache.xalan.xslt.Process -in bible01.xml -xsl bible01_01.xsl
//---------------------------------------------------
I DON'T KNOW WHY THE OUTPUT IS:
<?xml version="1.0" encoding="UTF-8"?>
<html>
Display this.
polo
</html>
0.95
0.0001785
WHY
0.95
0.0001785
COMES OUT IN THE OUTPUT,
BECAUSE I THOUGHT THAT I HAVE SET THE '/PERIODIC_TABLE/MARCO' (source element) in xsl file. THE OUTPUT SHOULD ONLY
INCLUDE
<html>
Display this.
polo
</html>
DO I HAVE SOME MISUNDERSTANDING ON THE SENTENCE FROM W3C:
The xsl:apply-templates element recursively processes the children of the source element.
I am so annoyed about using apply-templates. Is there any one know how to use apply-templates, or is there any tutorials in the
net?
thanks
Marco
[This message has been edited by Marco Yeung (edited October 08, 2001).]