1
   

What's wrong with this XML?

 
 
NeoGuin
 
Reply Wed 19 Oct, 2005 02:20 am
I've decided to try and teach myself XML (again).

I came up with a DTD (that's valid)

And used it to do the following XML

Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Timesheet SYSTEM "file:///C:/Documents and Settings/Jim/My Documents/XML/Timesheet.dtd">
<Timesheet>
<Employee>
<Name ID="1112763" SALARY="$9.25">John Smith</Name>
<Address Type="home">
<Street>1100 Main Street</Street>
<City>Anytown</City>
<State>PA</State>
<Zip>16121</Zip>
</Address>
<Position>Auditor</Position>
</Employee>
<Schedule>
<Store>
<Day>Monday</Day>
<Address Type="site">
<Site>SuperPetz</Site>
<City>Mechanicsburg</City>
<State>PA</State>
<Zip>17055</Zip>
</Address>
<StartTime>6AM</StartTime>
</Store>
<Store>
<Day>Wednesday</Day>
<Address Type="site">
<Site>Gander Mt.</Site>
<City>Harrisburg</City>
<State>PA</State>
<Zip>17000</Zip>
</Address>
<StartTime>5AM</StartTime>
</Store>
</Schedule>
</Timesheet>


Then I developed the following XSLT translation

Code:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/xhtml1/strict">

<xsl:output method="xml"/>
<xsl:template match="Timesheet">
<html>
<head>
<title>
<xsl:value-of select="Timesheet/Employee/Name"/>
</title>
</head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>

<xsl:template match="Timesheet/Employee/Address">
<xsl:value-of select="Timesheet/Employee/Address/Street"/><br/>
<xsl:value-of select="Timesheet/Employee/Address/City"/><br/>
<xsl:value-of select="Timesheet/Employee/Address/State"/><br/>
<xsl:value-of select="Timesheet/Employee/Address/Zip"/><br/>
</xsl:template>

<xsl:template match="Timesheet/Employee/Position">
<xsl:value-of select="Timesheet/Employee/Position"/><br/>
</xsl:template>

<xsl:template match="Timesheet/Schedule">
<table>
<xsl:for-each select="Store">
<tr>
<td>
<xsl:value-of select="Store/Day"/>
</td>
<td>
<xsl:value-of select="Store/Address/Site"/><br/>
<xsl:value-of select="Store/Address/City"/><br/>
<xsl:value-of select="Store/Address/State"/><br/>
<xsl:value-of select="Store/Address/Zip"/>
</td>
<td>
<xsl:value-of select="Store/StartTime"/>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>


But when I run the XSLT through MSXML(3.0) running inside XmlPad, all I get is a bunch of empty tags.

Is my XSL translator bad? Is the XSLT bad? Could I just create a CSS and import that into the XML, and how would I do this.
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 1 • Views: 900 • Replies: 2
No top replies

 
jayateertha 23mys
 
  1  
Reply Mon 13 Mar, 2006 11:21 am
What's wrong in my XML
Hello,

plz use this code in the xml file, it will work

<?xml-stylesheet type="text/xsl" file="path of the file"?>

ok.

bye
0 Replies
 
NeoGuin
 
  1  
Reply Thu 16 Mar, 2006 07:47 am
I will try that!
0 Replies
 
 

Related Topics

Webdevelopment and hosting - Question by harisit2005
Showing an Ico File - Discussion by Brandon9000
how to earn money in internet - Discussion by rizwanaraj
The version 10 bug. Worse then Y2K! - Discussion by Nick Ashley
CSS Border style colors - Question by meesa
There is no Wisdom in Crowds - Discussion by ebrown p
THANK YOU CRAVEN AND NICK!!! - Discussion by dagmaraka
I'm the developer - Discussion by Nick Ashley
 
  1. Forums
  2. » What's wrong with this XML?
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 05/23/2024 at 12:00:18