Forum Moderators: open

Message Too Old, No Replies

XML and XSL

         

breham

4:57 pm on Jan 19, 2006 (gmt 0)

10+ Year Member



Hi,

I have a webpage that searches a database which sends a reply back as an XML document. The XML Document is then saved as a variable ($page). This part I have no control of.

I would like to display the XML data using an XSL but don't understand how to tell the XML document about the XSL.

Any ideas gratefully received.

Brett

syber

5:12 pm on Jan 19, 2006 (gmt 0)

10+ Year Member



The easiest way is to add a processing instruction as the second line of the xml document.

<?xml version="1.0"?>
<?xml-stylesheet href="mystylesheet.xsl" type="text/xsl"?>

The href attribute points to where you have your XSL stylesheet stored. You also have the option of using a cascading stylesheet instead.

<?xml version="1.0"?>
<?xml-stylesheet href="mystylesheet.css" type="text/css"?>

breham

6:21 pm on Jan 19, 2006 (gmt 0)

10+ Year Member



Thanks Syber,

That's what I'd like to do but am unable to as the xml document comes back in $page variable.

Are there any other options that you know of?

Thanks again
Brett

mrMister

9:13 am on Jan 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That's what I'd like to do but am unable to as the xml document comes back in $page variable.

Well, if you really believe that you can't change it then there's not much you can do.

You'd be much better off asking your question in the PHP forums.

breham

1:35 pm on Jan 20, 2006 (gmt 0)

10+ Year Member



Thanks for your help mister I'll take a look in the PHP forum.