tags:

views:

36

answers:

2

Is there any way to show XML data in a good and readable format using PHP? I know I can build code to do this, but is there a function that does something similar I can reuse?

eg:

<animals><animal><name>Lion</name><type>Stay away</type></animal><animal><name>Koala Bear</name><type>Hug</type></animal></animals>

Is there some code that will show me the data in a decent format? eg:

Animal
  Name - Lion
  Type - Stay Away
Animal
  Name - Koala Bear
  Type - Hug

Some kind of XML to HTML display?

+2  A: 

Yes it is called XSLT and there is a XSL class in PHP.

With XSLT you can transform XML documents basically to any kind of output.

Felix Kling
+1  A: 

It is called XSLT, you can transform XML into anything. link text

LeonG