What is the error? Please Help

Here should go questions about transforming XML with XSLT and FOP.
s2009
Posts: 2
Joined: Mon Apr 27, 2009 8:27 am

What is the error? Please Help

Post by s2009 »

Hi all,

I am a beginner learning XML.

I have created the following XSL file:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org" version = "1.0">
<xsl:template match = "/">
<xsl:for-each select = "MARKS/CORE">
<xsl:text>MARK IN SUBJECT 1</xsl:text>
<xsl:value-of select = "M1"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

And the following XML file :

<?xml version ="1.0"?>
<?xml-stylesheet type="text/xsl" href = "Trial.xsl"?>
<MARKS>
<CORE>
<M1>100</M1>
<M2>90</M2>
</CORE>
<ALLIED>
<M3>100</M3>
<M4>100</M4>
</ALLIED>
</MARKS>

But when I run the above file in the browser it is just displaying the text "Mark in Subject 1" but the value of m1 is not displayed can any one identify the changes I should make to get the correct output.

Please help me out.

Thanks in advance!
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Re: What is the error? Please Help

Post by Dan »

For a good XSLT tutorial, please see:
http://www.zvon.org/xxl/XSLTutorial/Output/index.html
Best regards,
Dan
s2009
Posts: 2
Joined: Mon Apr 27, 2009 8:27 am

Re: What is the error? Please Help

Post by s2009 »

Dan wrote:For a good XSLT tutorial, please see:
http://www.zvon.org/xxl/XSLTutorial/Output/index.html
Best regards,
Dan

THANKS A LOT FOR PROVIDING THE LINK FOR THE TUTORIAL BUT CAN YOU FIND ANY ERROR IN THE XSL OR XML FILE WHICH I PROVIDED?

PLEASE HELP ME.
Radu
Posts: 9507
Joined: Fri Jul 09, 2004 5:18 pm

Re: What is the error? Please Help

Post by Radu »

Hi,

Your stylesheet does not correctly specify the XSLT namespace. It should be something like:

Code: Select all


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version = "1.0">
After that, everything should work fine.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply