You are here: Re: web app with php, xml, xsl, css « PHP Programming Language « IT news, forums, messages
Re: web app with php, xml, xsl, css

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация