...

View Full Version : Showing XML Data



webguy08
06-12-2009, 04:29 AM
Hi all,
I have an XML file, an XML Schema file, and an XSL Transform file, and I would like to display the data from the XML data in an XHTML file. How would I go about achieving this?

Thanks for any help :thumbsup:

Alex Vincent
06-12-2009, 08:02 AM
Any source code you care to share? We need more to go on.

webguy08
06-12-2009, 06:49 PM
:confused: If you really need the code, here it is:



<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="XSLT Revision.xslt"?>
<games xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="XSD Revision.xsd">
<game>
<name>Team Fortress 2</name>
<platform>PC</platform>
<price>12.00</price>
<developer>Valve</developer>
<publisher>Valve</publisher>
</game>
<game>
<name>Battlefield 1943</name>
<platform>PC</platform>
<price>15.00</price>
<developer>EA Games</developer>
<publisher>EA Games</publisher>
</game>
</games>



<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="games">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="game">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" type="xsd:string" />
<xsd:element name="platform" type="xsd:string" />
<xsd:element name="price" type="xsd:decimal" />
<xsd:element name="developer" type="xsd:string" />
<xsd:element name ="publisher" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>



<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="games">
<html>
<head>
<title>Revision</title>
</head>
<style type="text/css">
* { font-family: Arial; }
div div { background-color: Gray; padding: 5px; }
b { color: RGB(100,0,0); }
</style>
<body>
<xsl:for-each select="game">
<xsl:sort select="name" order="ascending"/>
<div>
<h2>
<b>Title: </b>
<xsl:value-of select="name"/>
</h2>
<div>
<b>Platform: </b>
<xsl:value-of select="platform"/>
</div>
<div>
<b>Price: </b>
<xsl:value-of select="price"/>
</div>
<div>
<b>Developer: </b>
<xsl:value-of select="developer"/>
</div>
<div>
<b>Publisher: </b>
<xsl:value-of select="publisher"/>
</div>
</div>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>


I would like to somehow embed the outcome of the data into an XHTML document.

webguy08
06-15-2009, 05:17 PM
Anyone? :(



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum