• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in xsl

 
srivatsan srinivasan
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i am new to the world of xsl.i tried my first example and couldn't get the ouput.if i apply the stylesheet it is showing the xml itself and not the output after the stylesheet is applied i am sending the program also which i downloaded from a website anyone please help me to get out of this
<?xml version="1.0"?>
<?xml-stylesheet type="text/xml" href="srivat.xsl"?>
<PERIODIC_TABLE>
<ATOM STATE="GAS">
<NAME>Hydrogen</NAME>
<SYMBOL>H</SYMBOL>
<ATOMIC_NUMBER>1</ATOMIC_NUMBER>
<ATOMIC_WEIGHT>1.00794</ATOMIC_WEIGHT>
<BOILING_POINT UNITS="Kelvin">20.28</BOILING_POINT>
<MELTING_POINT UNITS="Kelvin">13.81</MELTING_POINT>
<DENSITY UNITS="grams/cubic centimeter"><!-- At 300K -->
0.0899
</DENSITY>
</ATOM>
<ATOM STATE="GAS">
<NAME>Helium</NAME>
<SYMBOL>He</SYMBOL>
<ATOMIC_NUMBER>2</ATOMIC_NUMBER>
<ATOMIC_WEIGHT>4.0026</ATOMIC_WEIGHT>
<BOILING_POINT UNITS="Kelvin">4.216</BOILING_POINT>
<MELTING_POINT UNITS="Kelvin">0.95</MELTING_POINT>
<DENSITY UNITS="grams/cubic centimeter"><!-- At 300K -->
0.1785
</DENSITY>
</ATOM>

</PERIODIC_TABLE>

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<xsl:apply-templates/>
</html>
</xsl:template>

<xsl:template match="PERIODIC_TABLE">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="ATOM">
<P>
<xsl:value-of select="."/>
</P>
</xsl:template>

</xsl:stylesheet>
thanks in advance
srivatsan
 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The second line in your XML file should be
<?xml-stylesheet type="text/xsl" href="srivat.xsl"?>
not
<?xml-stylesheet type="text/xml" href="srivat.xsl"?>
Also, in your XSLT you use old namespace:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
here �WD-xsl� means �Working draft� and was in use some time ago, until XSL specification received final �Recomendation� status. Since then
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
is used.
Next typical reason of confusion: if you use Interner Explorer to process your XSLT, check which version of MSXML you use. Versions since 3.0 are claimed to be fully w3c compliant. The previous version, 2.6, was not fully compliant and exibited had some quirky behavior. You can check which version you use with MSXML Parser Sniffer
And here is very good FAQ about MSXML parser.

[This message has been edited by Mapraputa Is (edited June 15, 2001).]
 
srivatsan srinivasan
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi map,
Thanks it is working fine.i just changed the text/xml to text/xsl.thank u for ur timely help and also sending me the faq which is of great help.
srivatsan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic