|
Posted by Malcolm Dew-Jones on 10/08/22 11:19
petermichaux@yahoo.com wrote:
: Hi Malcolm,
: I grew up next door to a Malcolm Dew-Jones.
hum, I wouldn't be surprised if that's the same Malcolm that lived with my
Mom and Dad :)
: I think I figured out what I was after. I've attached it below.
: Thanks,
: Peter
: <?php
: //Step 1: Generate the xml string. This could be generated dynamically
: by querying a database
: $xmlString = "<collection>";
: $xmlString .= "<cd>";
: $xmlString .= "<title>Sailing The Seas Of Cheese</title>";
: $xmlString .= "<artist>Primus</artist>";
: $xmlString .= "<year>1991</year>";
: $xmlString .= "</cd>";
: $xmlString .= "<cd>";
: $xmlString .= "<title>Pure Guava</title>";
: $xmlString .= "<artist>Ween</artist>";
: $xmlString .= "<year>1992</year>";
: $xmlString .= "</cd>";
: $xmlString .= "</collection>";
: // Step 2: Transform the xmlString into html by using the xsl file
: $xml = new DomDocument;
: $xml->loadXml($xmlString);
: $xsl = new DomDocument;
: $xsl->load('collection.xsl');
: $proc = new XsltProcessor;
: $proc->importStyleSheet($xsl);
: $cdListHtml = $proc->transformToXml($xml);
Well, look at that, shows how much I know about php, doesn't it. I don't
see that in my php online docs. Time to do a php upgrade, I guess - I
hadn't realized I was that out of date. Or maybe I just didn't install
everything. In any case, checking now I see that various, interesting,
XML related capabilities are documented in the php manual (not mine, but
the one at the php web site), so I guess the php manual is still the best
place to look.
: // Step 3: Output the document that will be sent to the viewers browser
: echo "<html>\n";
: echo "<head>\n";
: echo "\t<link href='collection.css' type='text/css'
: rel='stylesheet'/>\n";
: echo "</head>\n";
: echo "<body>\n";
: echo $cdListHtml;
: echo "</body>\n";
: echo "</html>\n";
: ?>
thanks, bye.
--
This space not for rent.
Navigation:
[Reply to this message]
|