Register  |  Login




Advertisement

Start Your Own Q&A Site

Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.

Question

Status: Closed Points: 75 Time: 14:06 - Jul 12, 2006  

jgivoni

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

Categories

Answer Discussion
Tutorials

 

xarcus

Date:: Nov 11, 2006

Time:: 05:03

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!

jgivoni

Date:: Nov 11, 2006

Time:: 13:19

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.

xarcus

Date:: Nov 11, 2006

Time:: 17:36

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.

xarcus

Date:: Nov 11, 2006

Time:: 19:17

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.

xarcus

Date:: Nov 12, 2006

Time:: 09:26

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.

jgivoni

Date:: Nov 12, 2006

Time:: 13:08

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.

xarcus

Date:: Nov 12, 2006

Time:: 17:27

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...

Question Answered

This question has been closed, 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 a Tutorial in the Tutorial Area.

Answer 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:

Forgot Your Password?

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

Answer 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:

Forgot Your Password?

Ask a Question

Have a new question? Ask!

You have 100 characters to use



Top Experts

View More

Rank

Expert

Points

1.

nidhi

9829

2.

oracleofDelphi

6493

3.

rcastagna

5596

4.

LAGM

4773

5.

PeterNZ

3487

6.

gonzalo

2840

7.

Mason

2770

8.

jgivoni

2303

9.

xarcus

1820

10.

Anpanman

917

Become an Expert

Register today to share your knowledge with the community and be recognized and rewarded for your contributions.


Register Here




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



Language Options

English:

www.quomon.com

Español:

www.quomon.es