i'm having problems displaying XML. When i remove 3rd line i got error(that on line 5 is an extra bit, that is wrong...), and when i keep 3rd line i cant see anything when displaying it on website.. :( i'm not a XML pro so help would be appreciated

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="style1.css"?>
<?xml-stylesheet type="text/xsl" href="style2.xsl"?>

<title>Mathematics for computing</title>
<author>This module should help us understand:</author>
<contents>
  <chapter>Understand concept of Mathematics</chapter>
  <chapter>Be able to use Mathematics in programming</chapter>
  <chapter>Improve our logical thinking that will also help us when solving programming problem</chapter>
</contents>
<title>Web technology</title>
<author>This module should help us understand and be able to do</author>
<contents>  
  <chapter>Write basic java scripts</chapter>
  <chapter>Understand the way internet (internet programming works)</chapter>
  <chapter>Teach us doing basic web sites (HTML, XML)</chapter>
</contents>
<title>Communication and Learning Skills</title>
<author>This module should help us in the following:</author>
<contents>
  <chapter>Improve our writing skills</chapter>
  <chapter>Improve our thinking skills</chapter>
  <chapter>Improve our oral skills</chapter>
</contents>
<title>Information and Data Modelling </title>
<author>This module should help us to understand and be able to do:</author>
<contents>
  <chapter>We should be able to create Data modells by applying formal data model descriptions using data modeling techniques</chapter>
  <chapter>We should understand the concept of objec oriented programming/design</chapter>
  <chapter>Be able to produce Diagrams such as: Use case diagram, sequence diagram etc:</chapter>
</contents>
<title>Programming Methodology (Java)</title>
<author>This module should help us to understand and be able to do:</author>
<contents>
  <chapter>Understand the way programming works</chapter>
  <chapter>Understand what is mean by sequence which is the most important bit in programming</chapter>
  <chapter>Be able to do simple programs</chapter>
  <chapter>Learn basic commands in Java</chapter>
</contents>
<title>Computer Systems Fundamentals</title>
<author>This module should help us to understand and be able to do</author>
<contents>
  <chapter>Understand how computers works</chapter>
  <chapter>Understand how internet works</chapter>
  <chapter>Be able to do simple calculation regarding computing</chapter>
  <chapter>Learn PEP programming language(Machine code)</chapter>
</contents>
<title>Software Development Principles (Java)</title>
<author>This module is continuation of "programming methodology" at more advanced level</author>
<contents>
  <chapter>In this module we are improving our knowledge that we gained in "programming methodology module"</chapter>
  <chapter>We take all concepts of programming even further</chapter>
  <chapter>Programming it self is getting more advanced</chapter>
</contents>
<title>Software Engineering Principles</title>
<author>Ths module should help us to understand following</author>
<contents>
  <chapter>How software is developped</chapter>
  <chapter>Give us an idea of what possibilities are there to make such a system</chapter>
  <chapter>in fact i dont know what this module is for ...</chapter>
</contents>

<moduleList>
	<module>
	<moduleName>Web technology</moduleName>
	<moduledescription>Understanding and learning everything regarding internet/internet programming</moduledescription>
	<moduleCode>ECSC407.2</moduleCode>
	<moduleLeader>Wendy Purdy</moduleLeader>
	<timetableSlot>Wednesday 14pm-16pm</timetableSlot>
	</module>
	<module>
	<moduleName>Mathematics for computing</moduleName>
	<moduledescription>Understand concept of Mathematics</moduledescription>
	<moduleCode>ECSC408.Y</moduleCode>
	<moduleLeader>Daphne Economou </moduleLeader>
	<timetableSlot>Tuesday 12pm-13pm</timetableSlot>
	</module>
	<module>
	<moduleName>Communication and Learning Skills</moduleName>
	<moduledescription>Improve our communication skills</moduledescription>
	<moduleCode>EBSY400.Y</moduleCode>
	<moduleLeader>Maria Chondrogianni</moduleLeader>
	<timetableSlot>Monday 14pm-16pm</timetableSlot>
	</module>
	<module>
	<moduleName>Information and Data Modelling</moduleName>
	<moduledescription>Module should teach us all basics about data and information modelling</moduledescription>
	<moduleCode>EBSY401.1</moduleCode>
	<moduleLeader>Anush Begoyan </moduleLeader>
	<timetableSlot>Monday 11am-13pm</timetableSlot>
	</module>
	<module>
	<moduleName>Programming Methodology (Java)</moduleName>
	<moduledescription>Module should teach us basic programming in java</moduledescription>
	<moduleCode>ECSC401.1</moduleCode>
	<moduleLeader>David Hearnshaw</moduleLeader>
	<timetableSlot>Wednesday 09am-11am</timetableSlot>
	</module>
	<module>
	<moduleName>Computer Systems Fundamentals</moduleName>
	<moduledescription>Module should help us to understand how computers and internet works</moduledescription>
	<moduleCode>ECSC404.1</moduleCode>
	<moduleLeader>Cheng Lee </moduleLeader>
	<timetableSlot>Monday 09am-11pm</timetableSlot>
	</module>
	<module>
	<moduleName>Software Development Principles (Java)</moduleName>
	<moduledescription>Continuation of Programming methodology</moduledescription>
	<moduleCode>ECSC405.2</moduleCode>
	<moduleLeader>David Hearnshaw</moduleLeader>
	<timetableSlot>Thursday	11am-13pm</timetableSlot>
	</module>
	<module>
	<moduleName>Software Engineering Principles</moduleName>
	<moduledescription>Module should help us to understand principles of software engineering</moduledescription>
	<moduleCode>ECSC409.2</moduleCode>
	<moduleLeader>Epaminondas Kapetanios</moduleLeader>
	<timetableSlot>Thursday	14pm-16pm</timetableSlot>
	</module>				
</moduleList>

CSS style sheet

@charset "utf-8";
/* CSS Document */
title {font-size:18pt; color:red; font-weight:bold; display:block; font-family: Arial, Helvetica, sans-serif; margin-top:20pt; margin-left: 20pt;}

author{font-style:italic; display:block; color:black; margin-left: 25pt; margin-top:10pt; font-family: Times New Roman, Times, Serif; font-size:16pt;}

chapter{list-style-type:disc; margin-left: 25pt; display:list-item; color:black; font-family: Times New Roman, Times, Serif; font-size:14pt;}

XSL

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet  [
	<!ENTITY nbsp   "&#160;">
	<!ENTITY copy   "&#169;">
	<!ENTITY reg    "&#174;">
	<!ENTITY trade  "&#8482;">
	<!ENTITY mdash  "&#8212;">
	<!ENTITY ldquo  "&#8220;">
	<!ENTITY rdquo  "&#8221;"> 
	<!ENTITY pound  "&#163;">
	<!ENTITY yen    "&#165;">
	<!ENTITY euro   "&#8364;">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<xsl:template match="/">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Untitled Document</title>
</head>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>	

<body>
<h2>Module list </h2>

<table border="1">

  <tr bgcolor="#FF0000">

    <th align="left">Module Name</th>

    <th align="left">Description</th>    

    <th align="left">Module Code</th>
    
    <th align="left">Module Leader</th>
    
    <th align="left">Timetable Slot</th>

  </tr>

  <xsl:for-each select="touristAttraction/attraction">

  <tr>

    <td><xsl:value-of select="moduleName"/></td>

    <td> <xsl:value-of select="moduledescription"> </xsl:value-of> </td>

    <td><xsl:value-of select="moduleCode"> </xsl:value-of></td>

    <td><xsl:value-of select="moduleLeader"> </xsl:value-of></td>
    
    <td><xsl:value-of select="timetableSlot"> </xsl:value-of></td>

  </tr>

  </xsl:for-each>

</table>

</body>
</html>

</xsl:template>
</xsl:stylesheet>

Recommended Answers

All 2 Replies

maybe line 23 and 24 are causing problems...

ther a many mistake

so you will start display a html site

1.
xml is not valid
there a no root tag

in xml allow one information about stylesheet

<?xml-stylesheet type="text/xsl" href="style2.xsl"?>

the last one win and the browse display this

you will xml directly display with css than use

<?xml-stylesheet type="text/css" href="style1.css"?>

but you wil a html site so use
<?xml-stylesheet type="text/xsl" href="display.xsl"?

the stylesheet define alltag eg html style sript

so we start
xml make valid

<?xml version="1.0" encoding="utf-8"?>
<!-- xml direkt with css 
<?xml-stylesheet type="text/css" href="style1.css"?>
-->
<!-- hmtl code is descript -->
<?xml-stylesheet type="text/xsl" href="display.xsl"?>

<root>
	<title>Mathematics for computing</title>
	<author>This module should help us understand:</author>
	<contents>
		<chapter>Understand concept of Mathematics</chapter>
		<chapter>Be able to use Mathematics in programming</chapter>
		<chapter>Improve our logical thinking that will also help us when solving programming problem</chapter>
	</contents>
	<title>Web technology</title>
	<author>This module should help us understand and be able to do</author>
	<contents>
		<chapter>Write basic java scripts</chapter>
		<chapter>Understand the way internet (internet programming works)</chapter>
		<chapter>Teach us doing basic web sites (HTML, XML)</chapter>
	</contents>
	<title>Communication and Learning Skills</title>
	<author>This module should help us in the following:</author>
	<contents>
		<chapter>Improve our writing skills</chapter>
		<chapter>Improve our thinking skills</chapter>
		<chapter>Improve our oral skills</chapter>
	</contents>
	<title>Information and Data Modelling</title>
	<author>This module should help us to understand and be able to do:</author>
	<contents>
		<chapter>We should be able to create Data modells by applying formal data model descriptions using data modeling techniques</chapter>
		<chapter>We should understand the concept of objec oriented programming/design</chapter>
		<chapter>Be able to produce Diagrams such as: Use case diagram, sequence diagram etc:</chapter>
	</contents>
	<title>Programming Methodology (Java)</title>
	<author>This module should help us to understand and be able to do:</author>
	<contents>
		<chapter>Understand the way programming works</chapter>
		<chapter>Understand what is mean by sequence which is the most important bit in programming</chapter>
		<chapter>Be able to do simple programs</chapter>
		<chapter>Learn basic commands in Java</chapter>
	</contents>
	<title>Computer Systems Fundamentals</title>
	<author>This module should help us to understand and be able to do</author>
	<contents>
		<chapter>Understand how computers works</chapter>
		<chapter>Understand how internet works</chapter>
		<chapter>Be able to do simple calculation regarding computing</chapter>
		<chapter>Learn PEP programming language(Machine code)</chapter>
	</contents>
	<title>Software Development Principles (Java)</title>
	<author>This module is continuation of "programming methodology" at more advanced level</author>
	<contents>
		<chapter>In this module we are improving our knowledge that we gained in "programming methodology module"</chapter>
		<chapter>We take all concepts of programming even further</chapter>
		<chapter>Programming it self is getting more advanced</chapter>
	</contents>
	<title>Software Engineering Principles</title>
	<author>Ths module should help us to understand following</author>
	<contents>
		<chapter>How software is developped</chapter>
		<chapter>Give us an idea of what possibilities are there to make such a system</chapter>
		<chapter>in fact i dont know what this module is for ...</chapter>
	</contents>

	<moduleList>
		<module>
			<moduleName>Web technology</moduleName>
			<moduledescription>Understanding and learning everything regarding internet/internet programming</moduledescription>
			<moduleCode>ECSC407.2</moduleCode>
			<moduleLeader>Wendy Purdy</moduleLeader>
			<timetableSlot>Wednesday 14pm-16pm</timetableSlot>
		</module>
		<module>
			<moduleName>Mathematics for computing</moduleName>
			<moduledescription>Understand concept of Mathematics</moduledescription>
			<moduleCode>ECSC408.Y</moduleCode>
			<moduleLeader>Daphne Economou</moduleLeader>
			<timetableSlot>Tuesday 12pm-13pm</timetableSlot>
		</module>
		<module>
			<moduleName>Communication and Learning Skills</moduleName>
			<moduledescription>Improve our communication skills</moduledescription>
			<moduleCode>EBSY400.Y</moduleCode>
			<moduleLeader>Maria Chondrogianni</moduleLeader>
			<timetableSlot>Monday 14pm-16pm</timetableSlot>
		</module>
		<module>
			<moduleName>Information and Data Modelling</moduleName>
			<moduledescription>Module should teach us all basics about data and information modelling</moduledescription>
			<moduleCode>EBSY401.1</moduleCode>
			<moduleLeader>Anush Begoyan</moduleLeader>
			<timetableSlot>Monday 11am-13pm</timetableSlot>
		</module>
		<module>
			<moduleName>Programming Methodology (Java)</moduleName>
			<moduledescription>Module should teach us basic programming in java</moduledescription>
			<moduleCode>ECSC401.1</moduleCode>
			<moduleLeader>David Hearnshaw</moduleLeader>
			<timetableSlot>Wednesday 09am-11am</timetableSlot>
		</module>
		<module>
			<moduleName>Computer Systems Fundamentals</moduleName>
			<moduledescription>Module should help us to understand how computers and internet works</moduledescription>
			<moduleCode>ECSC404.1</moduleCode>
			<moduleLeader>Cheng Lee</moduleLeader>
			<timetableSlot>Monday 09am-11pm</timetableSlot>
		</module>
		<module>
			<moduleName>Software Development Principles (Java)</moduleName>
			<moduledescription>Continuation of Programming methodology</moduledescription>
			<moduleCode>ECSC405.2</moduleCode>
			<moduleLeader>David Hearnshaw</moduleLeader>
			<timetableSlot>Thursday	11am-13pm</timetableSlot>
		</module>
		<module>
			<moduleName>Software Engineering Principles</moduleName>
			<moduledescription>Module should help us to understand principles of software engineering</moduledescription>
			<moduleCode>ECSC409.2</moduleCode>
			<moduleLeader>Epaminondas Kapetanios</moduleLeader>
			<timetableSlot>Thursday	14pm-16pm</timetableSlot>
		</module>
	</moduleList>
</root>

xsl for html display.xsl
no use for each think xslt like

<?xml version="1.0" encoding="utf-8"?>
<!-- declared with doctpye here
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
<!ENTITY copy "©">
<!ENTITY reg "®">
<!ENTITY trade "™">
<!ENTITY mdash "—">
<!ENTITY ldquo "“">
<!ENTITY rdquo "”">
<!ENTITY pound "£">
<!ENTITY yen "¥">
<!ENTITY euro "€">
]>
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
	<xsl:output method="html" indent="yes" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
	<xsl:template match="/">
		<xsl:apply-templates select="root"/>
	</xsl:template>
	<xsl:template match="root">
		<html xmlns="http://www.w3.org/1999/xhtml">
			<head>
				<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
				<title>Untitled Document</title>
			</head>
                        <!-- here disscript css -->
			<style>
table {
border: 2px solid black;
}
th,td{
border: 2px solid black;
}
tr{
text-align: center;
}
tr.head{
text-align: left;
background-color:#ff0000;
}
tr.odd{
background-color:#ff9900;
}
tr.even{
background-color:#ff0099;

}
                      </style>
			<body>
				<h2>Module list</h2>
				<table>
					<tr class="head">
						<th>Module Name</th>
						<th>Description</th>
						<th>Module Code</th>
						<th>Module Leader</th>
						<th>Timetable Slot</th>
					</tr>
					<xsl:apply-templates select="moduleList"/>
				</table>
			</body>
		</html>
	</xsl:template>
	<xsl:template match="moduleList">
		<xsl:apply-templates select="module"/>
	</xsl:template>
	<xsl:template match="module">
		<tr>
			<xsl:choose>
				<xsl:when test="position() mod 2 = 1">
					<xsl:attribute name="class">odd</xsl:attribute>
				</xsl:when>
				<xsl:when test="position() mod 2 = 0">
					<xsl:attribute name="class">even</xsl:attribute>
				</xsl:when>
			</xsl:choose>
			<td>
				<xsl:value-of select="moduleName"/>
			</td>
			<td>
				<xsl:value-of select="moduledescription"/>
			</td>
			<td>
				<xsl:value-of select="moduleCode"/>
			</td>
			<td>
				<xsl:value-of select="moduleLeader"/>
			</td>
			<td>
				<xsl:value-of select="timetableSlot"/>
			</td>
		</tr>
	</xsl:template>
</xsl:stylesheet>

result xml --> html code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Untitled Document</title>
  </head>
  <style>
table {
border: 2px solid black;
}
th,td{
border: 2px solid black;
}
tr{
text-align: center;
}
tr.head{
text-align: left;
background-color:#ff0000;
}
tr.odd{
background-color:#ff9900;
}
tr.even{
background-color:#ff0099;

}
  </style>
  <body>
    <h2>Module list</h2>
    <table>
      <tr class="head">
        <th>Module Name</th>
        <th>Description</th>
        <th>Module Code</th>
        <th>Module Leader</th>
        <th>Timetable Slot</th>
      </tr>
      <tr class="odd">
        <td>Web technology</td>
        <td>Understanding and learning everything regarding internet/internet programming</td>
        <td>ECSC407.2</td>
        <td>Wendy Purdy</td>
        <td>Wednesday 14pm-16pm</td>
      </tr>
      <tr class="even">
        <td>Mathematics for computing</td>
        <td>Understand concept of Mathematics</td>
        <td>ECSC408.Y</td>
        <td>Daphne Economou</td>
        <td>Tuesday 12pm-13pm</td>
      </tr>
      <tr class="odd">
        <td>Communication and Learning Skills</td>
        <td>Improve our communication skills</td>
        <td>EBSY400.Y</td>
        <td>Maria Chondrogianni</td>
        <td>Monday 14pm-16pm</td>
      </tr>
      <tr class="even">
        <td>Information and Data Modelling</td>
        <td>Module should teach us all basics about data and information modelling</td>
        <td>EBSY401.1</td>
        <td>Anush Begoyan</td>
        <td>Monday 11am-13pm</td>
      </tr>
      <tr class="odd">
        <td>Programming Methodology (Java)</td>
        <td>Module should teach us basic programming in java</td>
        <td>ECSC401.1</td>
        <td>David Hearnshaw</td>
        <td>Wednesday 09am-11am</td>
      </tr>
      <tr class="even">
        <td>Computer Systems Fundamentals</td>
        <td>Module should help us to understand how computers and internet works</td>
        <td>ECSC404.1</td>
        <td>Cheng Lee</td>
        <td>Monday 09am-11pm</td>
      </tr>
      <tr class="odd">
        <td>Software Development Principles (Java)</td>
        <td>Continuation of Programming methodology</td>
        <td>ECSC405.2</td>
        <td>David Hearnshaw</td>
        <td>Thursday	11am-13pm</td>
      </tr>
      <tr class="even">
        <td>Software Engineering Principles</td>
        <td>Module should help us to understand principles of software engineering</td>
        <td>ECSC409.2</td>
        <td>Epaminondas Kapetanios</td>
        <td>Thursday	14pm-16pm</td>
      </tr>
    </table>
  </body>
</html>

sorry for bad english
please give your vote

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.