BizTalk Utilities CV ,   Jobs ,   Code library
 
Home Page


Add/Edit your code items
Search the code library
Browse for the code library


PHP XML


 
 

  
 


By Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First Posted 12/20/2001
Times viewed 634

Simple XSLT transformation with PHP 4.1.0 and Sablotron


Summary How to transform xml documents using Sablotron and PHP

Simle transformation using PHP and Sablotron

PHP's XSLT extension is no longer experimental as of version 4.1.0. Here is how to do a simple transformation and output it to the browser.

The process of transforming requires three steps

  • Create the xslt processor with xslt_create();
  • Process the xml and xsl files with the xslt_process() command
  • Free the processor with xslt_free()

Here is the syntax of the xslt_process function

mixed xslt_process (resource xh, string xml, string xsl [, string result [, array arguments [, array parameters]]])

There is quite a bit of flexablilty in xslt_process you can load your xml or xsl from a file or a string and output to a file or string. You also pass parameters via xslt_process().

You can find out more about Sablotron at http://www.gingerall.com/
And PHP's xslt functions at http://www.php.net/manual/en/ref.xslt.php

Additional information


Rate this article on a scale of 1 to 10 (0 votes, average 0)

Your vote :  

  
 





Leave a comment for this article
Your name
Your email (optional)
Your comment
Optional: Upload an attachment
Enter the code shown:

 
 

    Email TopXML