Register  |  Login

Question Details    

   Question

Time: 14:06 - Jul 12, 2006     Asked by: jgivoni      Status: Answered      Points: 75   

XSLT transformation in PHP 4/5 without "libxslt"?

I want to do XML/XSL transformations serverside (PHP), but since libxslt is not installed by default, most hosting services don't provide this option.

So far I have sent the XML and XSL file to the browser and let them take care of the transformation, which works flawlessly in Firefox, but appears to have many bugs in IE.

Therefore I would like to know if anyone provides a XSLT-library that do not have to be enabled in the core, but work as an add-on class?

Thanks,
Jakob

Ask a New Question

Become a Quomon Expert

Current Categories

 

Other Questions Needing Answers


   

Answer Discussion
Answer Discussion
Answer Summaries
Answer Summary
 
PHP 5 includes the XSL extension (libxslt) "by default" (Read http://www.php.net/manual/en/ref.xsl.php) which permits the use of PHP functions (standard or user defined) in the stylesheet as XSLT extension functions.

Read http://www.php.net/manual/en/function.xs...

With PHP4 you may use the XSLT (Sablotron) extension or the DOM XML extension

PHP5 XSL is much more powerful and the way to go!

Expert:

xarcus

Date:

Nov 11, 2006

Time:

05:03

 

Votes: Good (0) | Bad (0)
Login to rate this answer

From what I understand - and experience - the libraries are included in PHP4 and 5 but not enabled by default. With all the general hosting providers I have checked it is not enabled, therefore I cannot use it.

Expert:

jgivoni

Date:

Nov 11, 2006

Time:

13:19

 

Votes: Good (0) | Bad (0)
Login to rate this answer

I have been using hosting with PHP4 XSLT extension at KDAWebServices.com - You can check a phpinfo page at http://support.kdawebservices.com/forum/...

Nowadays XSL stylesheets are an important way to split logic and presentation.

You will find a bunch of hosting places offering the service searching at Google for the words: PHP hosting XSL OR XSLT

You may allways have a server at the office or at home and enable XSLT yourself.

Expert:

xarcus

Date:

Nov 11, 2006

Time:

17:36

 

Votes: Good (0) | Bad (0)
Login to rate this answer

Here is another interesting hosting site http://1and1.com that have php4 with XSLT and PHP5 with XSL extensions enabled (See phpinfo pages at http://faq.1and1.com/scripting_languages...)

You may find other places with XSLT enabled, just ask for the phpinfo page

I do not know about any xslt library as php script.

Expert:

xarcus

Date:

Nov 11, 2006

Time:

19:17

 

Votes: Good (0) | Bad (0)
Login to rate this answer

Another way would be to go for the "cool" XSLT version 2.0 which has a lot more features than version 1, without PHP but on Java or .Net

There is a free basic implementation (Saxon-B) for these platforms from Saxonica at http://saxon.sourceforge.net/

I have to try it some day.

Expert:

xarcus

Date:

Nov 12, 2006

Time:

09:26

 

Votes: Good (0) | Bad (0)
Login to rate this answer

Yeah, I liked the idea of xslt and became a bit frustrated that not a lot of other people considered it valuable - thanks a lot for all the information, I am definately going to check out v2.0.

Expert:

jgivoni

Date:

Nov 12, 2006

Time:

13:08

 

Votes: Good (0) | Bad (0)
Login to rate this answer

If you are new to XSLT I'd recommend to begin with version 1 since version 2 is somewhat more complicated.

Version 1 is short on functions but you can solve it using PHP5 functions in the stylesheet as stated before.

One think the version 1 lacks is node grouping to make grouped reports, but this is circumvented using "The Muenchian Method" (http://www.jenitennison.com/xslt/groupin...)

A good XSLT 1 mini-tutorial is at http://w3schools.com/xsl/default.asp although you'd better go to the specs for the function list since theirs contains some extra (XSLT 2) functions.

Sometime ago I wrote an XSLT 1.0 example (called Tiles) that includes many features at the LiteratePrograms wiki http://en.literateprograms.org/Category:...

XSLT 2.0 / XPath 2.0 comes with more data types including a list type but its definition has to be specified in an XML Schema file, and everything related to Schemas is out of the Saxon free edition and requires the commercial "Saxon-SA (Schema Aware)" edition.

XSLT Specs: http://www.w3.org/Style/XSL/

XSLT 2.0 vs XSLT 1.0 links:
http://www.oreillynet.com/xml/blog/2006/...
http://www.xml.com/pub/a/2002/04/10/xslt...

Expert:

xarcus

Date:

Nov 12, 2006

Time:

17:27

 

Votes: Good (0) | Bad (0)
Login to rate this answer

Question Answered

This question has been answered, and points have been rewarded to the following experts:

xarcus: 75

You're welcome however to comment or give additional information or if you wish, you have the ability to write an Answer Summary for this question by clicking on the "Answer Summaries" Tab.

 
No summaries have been submitted yet. Want to be the first?



Respond to this question:

New User

  Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:


Forgotten Password

 

New User

  Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:


Forgotten Password

   

"Psst, Quomon is a great site. Pass it on."     Tell a Friend  |   Link To Us  |   Save to Delicious  |   Digg! Digg it


All Questions


Language Options

English:

www.quomon.com

Español:

www.quomon.es

Quomon Blog

blog.quomon.com

Sponsors

Questions and Answers Software
Real Estate Postcards
Marketing Fulfillment