Reputation: 1457
Using this example: http://www.w3schools.com/xml/tryxslt.asp?xmlfile=simple&xsltfile=simple
I have three files:
Currently, I only know how to display individual .xml files on my browser by adding:
<?xml-stylesheet href="myxsl.xsl" type="text/xsl" ?>
How would I go about displaying data from the .xml file into an already built HTML page? My conditions are:
Which I suspect leads to SERVER side processing (I'm using a WAMP server). Any help here? I'm not an experienced XML or web person, please dumb it down for me ;)
EDIT: I only need to do selects, for loops and sorting. So basic XSLT stuff, I can understand.
Update: If I may, my working solution:
# START XSLT
$xslt = new XSLTProcessor();
$XSL = new DOMDocument();
$XSL->load('hello.xsl');
$xslt->importStylesheet($XSL);
# LOAD XML FILE
$XML = new DOMDocument();
$XML->load('hello.xml');
#PRINT
print $xslt->transformToXML($XML);
Upvotes: 1
Views: 331
Reputation: 1038730
You could perform the XSLT transformation of the XML file on the server and spit HTML to the client. Here's an article which illustrates the concept using PHP.
Upvotes: 2