Sablotron XSLT , PHP, Apache on Windows (and a basic XSLT tutorial)

It is actu­ally quite sim­ple to get it work­ing, but not ade­quately doc­u­mented on the PHP web­site. Get straight­for­ward, bul­let point instruc­tions here (installs PHP as a mod­ule which is in fact faster than run­ning it as CGI).

It is actu­ally quite sim­ple to get it work­ing, but not ade­quately doc­u­mented on the PHP web­site. Get straight­for­ward, bul­let point instruc­tions here (installs PHP as a mod­ule which is in fact faster than run­ning it as CGI).

  1. Get the lat­est PHP pack­age from http://qa.php.net/ and unzip it. It will auto­mat­i­cally cre­ate a folder named PHP_version. (P.S. Novice users may want to skip this entirely and down­load PHP, MYSQL etc bun­dled as
    XAMPP from Apachefriends.org.
    )
  2. Please fol­low the instruc­tions in the README to install
    Apache as a mod­ule (faster than run­ning as CGI). This should include –

    1. Copy­ing the lat­est PHP files into your C:PHP or wher­ever you have your PHP installed,
    2. Putting your PHP.INI file in the right place, mine is in C:WINDOWS (you must have only one valid INI file),
    3. Copy­ing the php4ts.dll file from your down­loaded PHP_version folder into C:WINDOWSSYSTEM32
  3. Copy all the *.dll files from your down­loaded
    PHP_versionDLL folder into the C:WINDOWSSYSTEM32.
    This will include the lat­est expat.dll and the
    sablot.dll.
  4. Copy the php_xslt.dll from your down­loaded PHP_versionEXTENSIONS folder into the C:WINDOWSSYSTEM32.
  5. Now, open your PHP.INI and uncom­ment the
    php_xslt.dll extension.


    1. # Remove the semi-colon ";" at the begin­ning
      # of the line to uncom­ment the PHP_XSLT exten­sion

      OLD LINE –> ;extension=php_xslt.dll

      NEW LINE –> extension=php_xslt.dll
  6. Just for ref­er­ence, my HTTPD.CONF file for Apache
    has the PHP mod­ule work­ing as follows:

    1. # P.S. The Load­Mod­ule should be php4apache2.dll
      if you use Apache 2

      Scrip­tAl­ias /php/ "c:/php/"
      Load­Mod­ule php4_module c:/php/sapi/php4apache.dll

      AddType application/x-httpd-php .php
  7. Restart Apache, and hope­fully time to say Bingo! If you have prob­lems, please let
    me know
    .


Test­ing your PHP XSLT installation:

Fol­low­ing is a zip file con­tain­ing some exam­ples for you to
test out your XSLT instal­la­tion. Unzip it into your htdocs
folder, it will cre­ate a sub­folder called xsltest.
Please read the README.TXT file inside this ZIP file for more.

Impor­tant notes to make sure XSLT works with PHP mod­ule of Apache:

  1. If run­ning PHP as a mod­ule gives you prob­lems, make sure you copy the
    php4ts.dll file from your down­loaded PHP_version
    folder into C:WINDOWSSYSTEM32. This is
    most often the cause of errors.
  2. Make sure you don't have many copies of the same DLLs lurk­ing around
    in var­i­ous fold­ers. This is often the prob­lem. Specif­i­cally, for instance,
    the same DLLs should not exist in C:WINDOWSSYSTEM and the C:WINDOWSSYSTEM32
    folders.
  3. If you are using really ancient ver­sions of PHP (i.e., ver­sion less
    than 4.1.xx) then this page
    may be use­ful
    to you as well.
If you are read­ing this, you may also want to check out this Zend Tuto­r­ial about PECL exten­sion for XSLT pro­cess­ing.
  • Atuk Daud

    I finally solved my prob­lem with the help of your instructions.

    Unfor­tu­nately, I guess I was a bit thick for a while. One addi­tional file that was miss­ing was the php_sablot.dll file (which doesn't seem to be included in the lat­est release of PHP). I found it in the prior pack­age that I had saved and every­thing started to work.

    In addi­tion, I found that I needed to put two dll's into my php direc­tory rather than the system/system32 direc­tory. These were the php_sablot.dll and the php_xslt.dll.

    I have also down­loaded the apache 1.3.27 (not dar­ing to use the apache 2. yet) and per­haps I haven't set some­thing cor­rectly for the path but it is all work­ing now.

    Thanks again.

  • abra­ham

    is there any rea­son why you sug­gest qa.php.net instead of http://www.php.net for the down­load of lat­est php? how is that different?

  • rob

    Thankyou very much, it's took me ages work­ing out how to do this, and now its up and run­ning… Cheers

  • / snip­tools

    Abra­ham, no there is no rea­son. I get my updates from the QA web­site because it usu­ally always has the lat­est qual­ity assured down­load from the PHP work group. You can get the same from http://php.net as well (which most often links to QA web­site anyway).

    Rob, glad to hear it! Have fun.

  • Jane

    I did what the instruc­tions told me. When I started up Apache the win­dow showed up and disp­peared promptly. Why's that?

  • / snip­tools

    Jane, appear­ing and dis­ap­pear­ing is alright as long as the server has started (not sure how you have set it up on your machine).

    If your server has not started (i.e., http://localhost doesn't work) then please check your "error.log" file for why Apache can­not start. This file can be found in "APACHE FOLDER / logs / error.log".

    Let me know.

  • Sleep­less

    Hi, I fol­low your very pre­cise and detailed instruc­tions: how­ever, I keep get­ting an error mes­sage every­time I browse to my phpinfo.php-File [includ­ing phpinfo();] after includ­ing the line

    extension=php_xslt.dll

    in my php.ini

    It says:
    Unknown(): Unable to load dynamic library ./extensions/php_xslt.dll; Pro­ce­dure not found

    Files are in proper place, php is Ver­sion 4.3.2, Win2K,
    extension_dir is ./extensions and the php_xslt.dll is in
    there, too.

    What am I miss­ing here?

    Thank you very much for your help!

  • / snip­tools

    Hi, what is the path to your Apache? Are you run­ning PHP as cgi or as a module?

    In gen­eral, the error you men­tion is the most com­mon. It means php_xslt is not found. Are you sure you fol­lowed step 4 above (copy­ing this to your system32 folder)?

    If that doesnt solve it, I would rec­om­mend rein­stalling your PHP.

    (1) Delete your entire PHP direc­tory.
    (2) Delete *ALL* occurences of DLLs lying around in sys­tem and system32 folder.
    (3) Start from step 1 here.

    I know this is painful, but if you fol­low all the steps, it really should work. Let me know how it goes.

  • ken

    ps: i kept going round in cir­cles but finally fig­ured it out. on win­dows 2000 you may also want to restart your sys­tem after unin­stalling php and the asso­ci­ated dll files just to make sure no dll files are stray­ing about. this alone will save you a lot of time!!!

  • joker

    Put this into your 'httpd.conf':

    Load­File dll/sablot.dll

    Where 'dll' rep­re­sents the folder where this dll is put. (This is for Apache2 and dll is a folder in ServerRoot)

  • lee

    qa.php.net had expat 1.95.2 and sablotron .97. If found these not cur­rent enough for some xslt I was try­ing that had javascript exten­sions. Does any­one know if we can just replace the .dll with the lastest ver­sions expat 1.95.6 and sablotron .98 ?

  • / snip­tools

    Hi lee, yes both work. Here is what I did:

    1. Got the lat­est Sablotron (http://download-2.gingerall.cz/download/sablot/Sablot-Win-0.98.zip )
    and grabbed only the sablot.dll from the pack­age; then, copied it into c:\windows\system32 folder (cheer­fully over­writ­ing exist­ing sablot.dll).

    2. Then, grabbed the lat­est expat_win32bin from http://sourceforge.net/project/showfiles.php&group_id=10127&release_id=136025 and 'installed' it (it's an exe). From the instal­la­tion folder, grabbed the expat.dll and libexpat.dll and copied them into system32 as well. (PS — libexpat.dll is not new).

    3. Restarted Apache. Tried sam­ple XSLT code. Works.

    Does this help?

  • Rudy

    I am get­ting this error:
    "Fatal error: Call to unde­fined func­tion: xslt_create() in C:\Apache\Apache2\htdocs\xsltest\simple.php on line 11"

    Which tells me I have not been suc­cess­full at enablel­ing XSLT on my machine.

    I have done every­thing stated on this page to no-avail. my ini is ok.…..files are incor­rect places.….. i have read and re-read every­thing on these posts.
    I even removed ever­thing and re-did from start.

    I am try­ing to install the lat­est Apache2 and PHP on win­dowsXP and then have is XSLT enabled.

    Any advice?

    Thanks in advance for any help.….
    Rudy

  • Rudy

    Shashank???? I grabbed the lat­est expat_win32bin from ttp://sourceforge.net/project/showfiles.php&group_id=10127&release_id=136025. BUT I see no expat.dll. I only see libexpat.dll.

    am still get­ting same error :(

  • / snip­tools

    Hi Rudy,

    1. About XSLT with Apache 2:

    After read­ing your mes­sage, I just installed my own Apache2 (which I have been putting off for a while) and fol­low­ing the above instal­la­tion, it works in 5 mins.

    2. About expat.dll in the down­loaded file

    It should be there. You need to install the expat pack­age (e.g., in the default C:\Program Files\Expat-1.95.6) and then nav­i­gate to C:\Program Files\Expat-1.95.6\Libs and look for expat.dll. Holler if you still cant find it, I'll put it up here for download.

    As for 1, I guess you may want to tell me your httpd.conf set­tings. To help you, here is what I use with my Apache2 httpd.conf –

    –> #**** AS MODULE
    –> Load­Mod­ule php4_module c:/php/sapi/php4apache2.dll
    –> AddType application/x-httpd-php .php .php4

    (Which is of course, the same as my httpd.conf for Apache 1.3.xx).

    Btw, my PHP.INI is in my c:\windows folder. Where's yours?

  • Rudy

    Still not working…xslt not enabled:(
    php.ini is in system32 folder

    i down­loaded "expat_win32bin_1_95_6.exe" from source­foge as you did Shashank.
    NO expat.dll
    just these two: libexpat.dll and libexpatw.dll
    ——
    i have expat.dll but it is the one that came with "php-4.3.2-Win32" download

    *******httpd.conf*****(located in c:/apache/apache2/conf)

    Load­Mod­ule php4_module c:/php/sapi/php4apache2.dll

    Scrip­tAl­ias /php/ "c:/php/"

    AllowOver­ride All

    Direc­to­ryIn­dex index.html index.html.var index.php

    AddType application/x-httpd-php .php .php4
    AddType application/x-tar .tgz
    AddType image/x-icon .ico

    ========================
    *******php.ini******(located in system32)

    extension=php_iconv.dll

    extension=php_xslt.dll

    HELLLLPPPP.….
    again thanks

  • Rudy

    ok…i found expat.dll on "Expat-1.95.2"
    put it in system32.…..still not working.…

    REMOVED every­thing again…RE-DID every­thing slowly.…NOPE…did not work either.…

  • Rudy

    ME again — no suc­cess yet
    I put all my info in an area you can look at.
    I have the steps i did, plus what files and from where I got them…
    (http://pub227.ezboard.com/fanela14638frm2) So please go look at what I did…maybe you can see where I am going wrong.

    HERE IS MY PHP PAGE INFO: http://anela.com/temp/myphpinfo.html

  • / snip­tools

    Rudy, any par­tic­u­lar rea­son why you are work­ing with a 4.3.3-dev build instead of the sta­ble 4.3.2 branch? Not that this should mat­ter, but this is one big dif­fer­ence from my setup. Other than this, some other dif­fer­ences in the phpinfo() listing –

    1. In the "Con­fig­u­ra­tion File (php.ini) Path" sec­tion I see a full path like this –

    C:\WINDOWS\php.ini

    Your phpinfo list­ing only seems to show "C:\WINDOWS".

    2. My "Exten­sions Dir" in the "PHP Core" sec­tion shows this –

    ./

    Yours shows a spe­cific path "c:\php4". Can you try renam­ing your PHP.INI's "extension_dir" to just a dot-slash and see if that helps?

  • Jor­gen Horstink

    Okey this is my problem:

    OS: Win­dows XP Prof.
    Two dri­ves:
     – C

  • Jor­gen Horstink

    Okey,

    I finally works!

    I back­graded to Apache 1.3x and installed php again…
    But I don't know why it didn't work before :s

    Thanks any­way

  • Saidy Jade

    Nice exam­ple, other good exam­ples I have found good are an zvon.org which have an exam­ple based ref­er­ences guides to xslt.

    To elim­i­nate the config.php file use
    the xslt_set_base func­tion. (I removed most of the com­ment so this takes up less space)

    $xml_file = "simple.xml";
    $xsl_file = "simple.xsl";

    $xh = xslt_create();

    // set the base to the cur­rent work­ing direc­tory.
    $file­Base = 'file://' . getcwd () . '/';
    xslt_set_base ( $xh, $fileBase );

    // Process the doc­u­ment
    $result = xslt_process($xh, $xml_file, $xsl_file);
    if (!$result)
    {
    echo 'XSLT pro­cess­ing error: ' .xslt_error($xh) ;
    }
    else
    {
    echo $result;
    }
    xslt_free($xh);

    ?>

  • Saidy Jade

    Jor­gen check that you have this line in your PHP.INI file.

    enable_dl = On

    This is in your apache2 conf

    Load­Mod­ule php4_module c:/php-4.3.2/sapi/php4apache2.dll

    The apache2 sapi mod­ule is still rather under heavy devel­op­ment, it also doesnt like mysql 4.0

  • Saidy Jade

    add this to the complex.xsl to dis­play the actual pic­ture from amazon.com

    <xsl:template match="picture">
    <img>
    <xsl:attribute name="src"><xsl:value-of select="."/></xsl:attribute>
    </img>
    </xsl:template>

    update/modify the local-name(.)='url' to to below to dis­play an actual click­able link and not just text.

    <xsl:when test="local-name(.)='url'">
    <b>More info from this link: </b>
    <a>
    <xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
    <xsl:value-of select="."/>
    </a>
    </xsl:when>

    modify/update <xsl:value-of select="."/> to remove the text when the URL tag is parsed.

    <xsl:if test="local-name(.) != 'url'">
    <xsl:value-of select="."/>
    <br/>
    </xsl:if>

    And there you have it, pro­bar­aly what the orig­i­nal author was try­ing to achieve and this prove that it was a very good example/article.

    Nice job indeed.

    so for those who are not quite clear 😛 you need to use the xsl:attribute tag for nor­mal html ele­ment attrib­utes, src, href, height, width, bor­der.. etc etc

    <img src="/my.img" height="40"> becomes:

    <img><xsl:attribute name="src"><xsl:value-of select="."/></xsl:attribute><xsl:attribute name=" height">40</xsl:attribute></img>

    and so on. bte sorry for tak­ing up so much space but I thought this might be use­ful for some people.

  • / snip­tools

    Saidy Jade, thanks for the com­ments, they are help­ful indeed. Will change some exam­ples when I get the time.

  • Agung Pri­hang­goro

    hi,..
    i've had trou­ble on installing xslt into my machine,

    what i've done :
     – put all .dll files into C:\windows\system32\ folder,
    (expat.dll, libexpat.dll, sablot.dll, xmlparse.dll, xmltok.dll)
     – uncom­ment xslt and sablot on my php.ini files
    extension=php_sablot.dll
    extension=php_xslt.dll
     – last,.. restart­ing my computer,..

    then, I start apache, and test some xsl code,
    but, there's noth­ing hap­pen, my browser just stuck up and showed "load­ing doc­u­ment", but it never finished,..

    please, help..

    i use PHP­Triad 2.1.1 on win­dows '98, and using default set­ting, apache-instal folder : C:\apache\ php-instal folder : C:\apache\php
    php.ini files : C:\apache\php\php.ini
    exten­sions files : C:\apache\php\extension\

  • / snip­tools

    Agung,

    I am not sure why you use PHP­Triad, espe­cially ver­sion 2.1.1 (that is not the lat­est) when the indi­vid­ual things to install are cleaner and safer these days. I mean, install PHP, Apache and MySQL separately.

    Apart from this, it seems your "php4ts.dll" is not in your system32. Try that and let me know if it works. I am not sure how Php­Triad installs your PHP — is it work­ing as mod­ule? You might do best to fol­low the instruc­tions on this page.

    Shanx

  • Gia­como

    Hi, i installed sablotron cor­rectly, but i have another kind of prob­lem. If i change the "doc­u­men­t­root" of the Apache, Sablotron seems not to work. I use this code:

    $xh = xslt_create();
    $result = xslt_process($xh, 'arg:/_xml', 'Apache-Server/…/filename.xsl');

    but i get this error code:
    Warn­ing: Sablotron error on line none: can­not open file 'c:/programs/apache group/apache/Apache-Server/…/filename.xsl' …

    Obvi­ously "c:/programs/apache group/apache" is the apache instal­la­tion direc­tory.
    bye and thanks.

  • / snip­tools

    Gia­como, I dont quite under­stand the paths you are try­ing to work with — what is "Apache-Server"? I guess you seem to have answered your own ques­tion because the error "can­not open file" most def­i­nitely has to do with invalid paths, why do you wish to write the paths the way you do?

  • gianna

    I've installed Apache 1.3.24(CGI) + Php 4.1.2 + MySQL 3.0 run­ning on Win 98 and work well. I've installed also Expat 1.95.6 and I down­loaded Sablotron 0.90 to pars­ing Xml doc­u­ments on Php, but my ques­tion is : how I install the bina­ries of Sablotron ? Please, could you help me ?

  • Michael Quinn

    Hi,

    I thought this might help aswell as it did for me.
    In the PHP.ini file change the exten­sion dir path to the fol­low­ing (If you are using either PHP­Triad or FoxServ).

    extension_dir = C:\WINDOWS\system32

  • Mail­man

    hi,
    thanks for the info, it was very useful!

    mail­man

  • Iggy

    Please, guys, help me!

    All things are work­ing OK.

    Tell me please how to spec­ify XML file if it is on another server. How to write the way to it?

    Thanx.

  • Fletch

    Hi,

    I'm try­ing to process an XSLT stylesheet using the xslt_process() func­tion and rel­a­tive URLs to the .xsl files. Like so:

    $strHTML = xslt_process($xh, 'arg:/_xml', 'xsl/test.xsl', NULL, $arguments);

    with the script in "C:/localhost/content/" and the xsl file in "C:/localhost/content/xsl/"

    It's pretty basic. But…

    … it's not work­ing and xsl_error() tells me:

    "can­not open file 'C:/PHP/xsl/test.xsl'"

    …but why are you look­ing for it there Mr. Sablotron?!

    Any help much appre­ci­ated! (I think that Gia­como is hav­ing the same problem)

  • Gia­como

    I think so…

    "Apache-Server" is the "doc­u­men­t­root" I set in the apache con­fig­u­ra­tion file. It's the direc­tory where i would like to insert my php files to process.

  • / snip­tools

    You can spec­ify any file path with PHP code for XSLT using the "xslt_set_base" func­tion. Did you try out the code sam­ples? There is code like this –

    $file­Base = 'file://' . getcwd () . '/';
    xslt_set_base ( $xh, $fileBase );

    You can change your $file­Base vari­able to any path you want, as long as it is local (IIRC).

  • Gia­como

    Per­fect, using "xslt_set_base" it works…thanks a lot…=))

  • p_php

    while run­ning apache after installing php as a mod­ule its giv­ing this error

    Can­nor locate API mod­ule struc­ture php_module in file c:\apache\moudle\php\sapi\phpapache.dll..cified pro­ce­dure could not be found..
    I've fol­lowed the PHP instal­la­tion and con­fig­u­ra­tion Steps properly.….….I'm run­ning apache 1. and Php 4.3.3

    Please help

  • / snip­tools

    What is the "mou­dle" in the error file path? I guess it should be "moD­Ule"? In which case, you have an error with your file paths somewhere…that's my guess based on the infor­ma­tion you pro­vide above. Let me know if this was it.

  • E. Brown

    I am tring to setup xslt for php on my apache web server hav­ing fol­lowed your instruc­tions I still get the error:

    Fatal error: Call to unde­fined func­tion: xslt_create() in C:\Program Files\Apache Group\Apache2\htdocs\xsltest\simple.php on line 8

    Any sug­ges­tions as to what might be wrong with my con­fig­u­ra­tion, php in gen­eral is working(phpinfo.php works fine)

    Thank you,
    E. Brown

  • / snip­tools

    Def­i­nitely a case of some DLLs lying scat­tered in dif­fer­ent fold­ers. Con­sider delet­ing all the DLLs you copied into your SYSTEM and SYSTEM32 fold­ers, and then re-copying them once again based on the PHP instruc­tions and then instruc­tions on this website.

    If it still does not work, please pro­vide more details about OS, path, PHP ver­sion, XSLT (Sablotron) ver­sion etc.

    Thanks

  • mer­lynda

    Can you share the code you used to strip today's Dil­bert comic off the Dil­bert site and place on the Snip­Tools website?)

    Very Cool!

    Thanks very much.

  • mer­lynda

    I found the Dil­bert script on your site. Thanks. For oth­ers who may be inter­ested see "Dil­bert a day with PHP, SOAP using NUSOAP".

  • / snip­tools

    Thanks mer­lynda. The code for Dil­bert is at:
    /vault/000001.htm

  • Paul Edwards

    Hi there,

    If you're try­ing to load php mod­ules in win­dows and win­dows reports that it "can't find the mod­ule" (and you're going mad because you know it's there) it's likely that a depen­dency dll is not on your sys­tem. I had this prob­lem with php_xslt.dll and found this use­ful tool : depen­dency walker http://www.dependencywalker.com

    I just opened the php_xslt.dll in the tool and it iso­lated which dll's were miss­ing. In my case it was that libexpat.dll and php4ts.dll which weren't avail­able. I copied them to System32 and hey presto.

    Hope this helps.

    Cheers

    Paul

  • Adrian

    I should have read Paul Edwards's com­ments before embark­ing on the same darn thing over again :)

    I couldnt' start apache with the dec­la­ra­tion in the php.ini file to load the xslt exten­sion: it kept say­ing that the file didn't exist. Fol­low­ing the instruc­tions pro­vided exactly fixed it for me though.

    Cheers
    Adrian.

  • Peter

    Hi Paul, tnx for your advice!!
    This tool men­tioned that iconv.dll was miss­ing, so I copied it to the system32 folder and now, after hours of research, all is work­ing fine. Thanks a lot.

    Peter

  • Ray Williams

    A well laid out site with decent and up-to-date infor­ma­tion, well done. Great site lay­out too! Any tips for myself, I wish to start with PHP and inte­grate MYSQL into some sort of Web-Data base application.

  • / snip­tools

    Hi Ray, thanks for the com­ments. Your ques­tion though is a lit­tle vague. What kind of work do you intend to do with PHP/MySQL?

  • VK

    I have a well run­ning php/apache sys­tem. I did not use the qa.php.net for installing. I am using the XAMPP thing, what­ever that means. But so far so good.

    Now, I wanted to do some xml/xslt work. Mainly the sablot exten­sion, so I write one file and it failed. "Fatal error: Call to unde­fined func­tion: xslt_run() in C:\xampp\htdocs\nku\xmltest1.php on line 11
    "

    Now above the XSLT_RUN com­mand, the XSLT_create() line didnt fail. Should it have ??? Any­way, any ideas why this is happening ??

    Based on the talk here, I think my PHP is a mod­ule. And all my dlls are in the XAMPP direc­tory. I dont want to move DLLs around, since every­thing else works. The exten­sion line is uncom­mented in the INI file also. What else can go wrong ???

  • / snip­tools

    VK, your prob­lem is sim­ple and one that usu­ally crops up when XSLT is not installed prop­erly, or not enabled in the PHP.INI file. Unless you fol­low the instruc­tions sug­gested on this site, it is kind of dif­fi­cult to really help you. Let me know how it goes, good luck. (PS: I am not famil­iar with the XAMPP stuff)

  • Jacque­line

    Hello There.

    I found this page very use­ful. How­ever, after much strug­gling I still seem to have a problem.

    I am run­ning Win XP home, PHP 4.3.3
    and I still get the fol­low­ing error:
    Call to unde­fined func­tion: xslt_process().. you know the rest. I have dou­ble and triple checked and I think I did every­thing correctly.

    How­ever, I down­loaded Depency Walker, which I found a handy tool, it sniffed out a miss­ing dll, and I was able to fix that. I do how­ever, get a

    ' Warn­ing: At least one mod­ule has an unre­solved import due to a miss­ing export func­tion in a delay-load depen­dent mod­ule.' in depen­dency walker.

    the cor­re­spond­ing dll is : MPR.dll, I tried down­load­ing it and got it from another machine, but I still get the same error. So I was won­der­ing if some­one could send it to me, so that I can check whether that will solve my prob­lem. Since I will know there is noth­ing wrong with the dll. [I am not that clued up with this side of things] The other issue as per usual is, could it just be Win XP home giv­ing me problems?

    I would appre­ci­ate any and all help, com­ments or ideas in this regard

    Chee­rio
    Jacque­line
    [email protected]

  • danilo

    if you have php => 4.4.2
    you mast copy expat.dll,sablot.dll,iconv to
    windows/system32

    in your php.ini
    jo must uncom­ment line: extension=php_xslt.dll

    this must work!

  • John

    Any­one make this work with IIS?

    I get NOTHING from the scripts… lat­est PHP down­load, lat­est sablot.dll, libexpat.dll, iconv.dll all in system32 direc­tory. php_xslt.dll in system32 direc­tory and uncom­mented in php.ini…

    I also don't get any XSLT mod­ule from phpinfo().

    Does PHP need to be run as a mod­ule for these to work?

  • Guest

    I used the instruc­tions on:

    /php_xslt_on_windows

    When run­ning http://ged.nork.auc.dk/xsl/test.php I get the fol­low­ing message:

    Warn­ing: xslt_process(): sup­plied argu­ment is not a valid XSLT Proces­sor resource in C:\www\xsl\test.php on line 51
    Trans­for­ma­tion failed.

    Any ideas?

  • Peter De Bouvere

    Hi,

    I fol­lowed every step of your tuto­r­ial, but I still can't seem to parse xml through php.
    I use this php file:

    It dis­plays my error mes­sage that I typed in, because xslt_error() doesn't work (dis­plays noth­ing).
    Any ideas?

  • Peter De Bouvere

    My php wasn't dis­played… let's try again:

    $proc = xslt_create(); // this cre­ates the xslt proces­sor
    $xml = "example.xml";
    $xsl = "example.xsl";
    $html = xslt_process($proc, $xml, $xsl) or die ("You're in deep sh*t…");
    echo $html;
    xslt_free($proc);

  • Padraig

    Hi,

    I had the same prob­lem with installing the XSLT. I'm on Win­dows 98, IIS 4, and the php 4.3. John, I had the same prob­lem as you, until I copied the files to the *c:\windows\system* folder, not system32. Then to my great sur­prise, it worked. (after eas­illy 4 hours of try­ing dif­fer­ent stuff)

    I got this hint from read­ing the ldap entry at PHP (I believe the mail­ing lists) where the same prob­lem is described.

    Just for infor­ma­tion, I believe that pop up win­dow is from php not han­dling the excep­tion mes­sage that Win­dows is send­ing, and as a result is just pop­ping the error up to a win­dow. That 'device is not func­tion­ing' mes­sage is a sys­tem defined error.

  • Liquibyte

    Found the solu­tion and it's a doozie. Copy php4apache.dll (or php4apache2.dll as the case may be), php4ts.dll, expat.dll, sablot.dll, and php_xslt.dll to C:\WINDOWS\system32. Make sure you rename the orig­i­nals to 'filename.dll.bak' as I did.

    In php.ini find 'extension_dir =' and make sure it says this: 'extension_dir = "C:\WINDOWS\system32"'. Uncom­ment ';extension=php_xslt.dll' to be 'extension=php_xslt.dll'.

    In httpd.conf, find put 'Load­Mod­ule php4_module c:/WINDOWS/system32/php4apache.dll' (replac­ing the appro­pri­ate dll if using apache 2 of course).

    This took me two installs, hav­ing to mess with the above men­tioned pro­gram to sniff out depen­dan­cies found that the mpr.dll was the prob­lem with php_sablot.dll. On a hunch I recom­mented the extension=php_sablot.dll in php.ini and that did the trick.

    This was done with Apache/1.3.29, PHP/4.3.4, and WinXP pro. Just in case you were wondering.

    Good luck to the next per­son, I hope this helps.

  • jkue

    Hi,
    to those installing on XP + W2K3 like I did this is a sim­ple process using PHP 4.3.4.4 Apache 2.48 con­fig­ured with JRun
    on Win­dows 2003 Server Enter­prise and Win­dows XP Pro. The XML sam­ples work fine
    even with­out sablot in the system32 folder, not sure if I need sablot cause the trans­for­ma­tion
    works fine with­out it. Sablot is also not located in the exten­sions folder.

    copy all dlls from EXTENSIONS folder to the windows\system32 folder
    copy all dlls from DLLS folder to the windows\system folder
    copy the php4ts.dll to the windows\system32 folder (this must be done)

    php.ini
    ;extension_dir = (noth­ing here)
    to extension_dir = "C:\php\extensions"

    http.conf
    Load­Mod­ule php4_module C:/php/sapi/php4apache2.dll

    No need to re-start the sys­tem, just the web­server. Why copy the exten­sions files to
    the system32 folder? I have recog­nised that the web­server has had trou­ble find­ing the dlls
    when I just ref­er­enced the exten­sions folder, so I tried it like this and it worked fine.

    cheers

  • jkue

    uncom­ment these nat­u­rally
    extension=php_xmlrpc.dll
    extension=php_xslt.dll

  • / snip­tools

    Thanks JKue, very use­ful info!

  • Chris­t­ian

    Reply to John on Octo­ber 23, 2003 04:50 AM:
    Any­one make this work with IIS?

    Dear John,

    To install PHP and Sablotron on Win­dows XP pro & IIS, the fol­low­ing worked with me:

    1) Get the lat­est PHP Win­dows installer pack­age from http://www.php.net/downloads.php and install it
    2) Get the lat­est PHP source pack­age from http://qa.php.net/ and unzip it (it will auto­mat­i­cally cre­ate a folder named PHP_version).
    3) Check that your PHP.INI file is in the right place, i.e. mine is in C:\WINDOWS (you must have only one valid INI file),
    4) If not already there, copy the php4ts.dll file from your down­loaded PHP_version folder into C:\WINDOWS\SYSTEM32
    5) If not already there, copy all the *.dll files from your down­loaded PHP_version\DLLs folder into the C:\WINDOWS\SYSTEM32. This should include the lat­est expat.dll and the sablot.dll.
    6) If not already there, copy the php_xslt.dll from your down­loaded PHP_version\EXTENSIONS folder into the C:\WINDOWS\SYSTEM32.
    7) Now, open your PHP.INI and uncom­ment the php_xslt.dll extension:

    # Remove the semi-colon ";" at the begin­ning
    # of the line to uncom­ment the PHP_XSLT exten­sion
    OLD LINE –> ;extension=php_xslt.dll
    NEW LINE –> extension=php_xslt.dll

    8) Of course you need to cre­ate a vir­tual direc­tory with IIS and put your exam­ples in that direc­tory to test the engine, e.g. try (http://images.devshed.com/Server_Side/XML/XSLTrans/XSLTrans.pdf)

  • lam­puki

    Copy­ing the cur­rent libexpat.dll to the sys dir did the trick for me. It wasn't quite obvi­ous when I read the tuto­r­ial, but now it hap­pily functions.

    lam­puki

  • Jane

    I got this error when I ran my PHP script:

    Warn­ing: Sablotron error on line 15: XML parser error 11: unde­fined entity in c:\Program Files\Apache Group\Apache2\htdocs\hrl\index.php on line 38
    XSLT error [2]: XML parser error 11: unde­fined entity

    This line is: $result = xslt_process($xh, 'arg:/_xml', 'file://'.$XSLT, NULL, $args, $params); and every­thing worked fine with my other php files.

    How can I find out which entity is undefined?

    Thanks a lot.

  • / snip­tools

    Hi Jane,

    Did you try the code sam­ple included on this page? That should give you some ideas.

    Any­way, as regards your own code, the snip­pet you men­tion in your note above only con­tains a ref­er­ence to an XML file, so it is dif­fi­cult to tell which entity you are talk­ing about. Would it be pos­si­ble for you to pro­vide your XML plus the XSLT file?

    If you feel it is not a good idea to do that online, please feel free to email me per­son­ally, and I'll see if I can be of some help.

    Cheers.

  • skoila

    THANKS A LOT!!

    I've been try­ing to install this php_xslt dll fo 2 hours… !! (and I began to look at php 3 hours ago and every­thing looks really good, mySql…etc)

    Hap­pily I've finally found your nice (and work­ing) expla­na­tion… I'll be able to sleep tonight!

  • Alex

    Just say BINGO!!!
    THANKS!!
    Work fine.. i've pass more then 3hours to find out why it's does'nt work.… your pro­ce­dure was per­fect… thanks!

  • Basel

    You are AWESOME. I spent a week tryig to get Sablotron to work fol­low­ing their idi­otic instruc­tions and to an avail. I look at your instruc­tions and I got every­thing to work in 5 min­utes. Thank you.

  • Elnikoff Thierry

    How do you do this with PHP 5 ? I get con­tin­u­ously the same error !

  • / snip­tools

    Hi Edward, I have not tried PHP5, but I doubt that the pro­ce­dure should be any dif­fer­ent. What error do you see? A spe­cific error mes­sage would be use­ful in help­ing you out. Let me know, Shanx

  • DrHSD

    Greet­ings,
    I have installed Apache/2.0.49(Win32) and PHP4 on my machine (Win­dows XP) fol­low­ing your instruc­tion. Though it seems that it is work­ing, but when I try http://localhost/phpinfo.php it gives the fol­low­ing error:

    Fatal error: Call to unde­fined func­tion: info() in C:\Apache Group\Apache2\htdocs\phpinfo.php on line 1

    Could you tell me what's wrong.
    Thnaks, drhsd

  • DrHSD

    Hi again,

    I sent you a ques­tion a few min­utes ago…; I just restarted apache and it's now telling me
    Unkwon(): Unable to load dynamic library 'c:/php\php-xslt.dll — The spec­i­fied mod­ule could not be found.

    Could you give some hints please.

    Thanks again, __drhsd

  • / snip­tools

    DrHSD, the first error of course is because you had "info()" in your pro­gram, it should be "phpinfo()". The sec­ond error is because you have not installed the XSLT mod­ule prop­erly. Please fol­low the instruc­tions on the top of the page, word by word. It has to work, it's worked for tons of peo­ple with Win­dows and PHP4.1xx and above. If it doesn't, then write to me again with your OS, Apache ver­sion, and PHP ver­sion. –Shanx

  • DrHSD

    Greet­ings,
    Thank you very much for your prompt reply and very help­ful advice. Yes, I changed info() to phpinfo() and it is work­ing fine now! How­ever, when I unco­mented extension=php_xslt.dll and started Apache I got the fol­low­ing warning:

    Unkown(): Unable to load dynamic library 'c:/PHP\php_xslt.dll' — The spec­i­fied mod­ule could not be found.

    Now when I com­ment it out Apache starts with­out that warn­ing and every­thing looks fine again! I'm using Apache/2.0.49(Win32) and PHP4 on Win­dows XP.
    Please advise. Thanks again, drhsd

  • mirko

    hi!
    i have an Error mes­sage:
    can­not load mod­ule php_xslt.dll …
    In fact the file don't exists
    in the exten­sion line on php.ini and in dir exten­sions
    i use php5 rc1 on win 2k and apache 1.3.24
    there is a file php_xsl.dll works equal
    or not?
    bye mirko

  • Dmitry

    Installed Apache 1.3.29 PHP from qa.php.net on
    Win2K Prof, fol­low the instruc­tions.
    Yes, sim­ple XML/XSLT work­ing good.
    But Apache can't go to the link like
    localhost/page.php§ion=1&model=1
    always go right to page.php
    For Apache (?section=1&model=1) no exist
    Whats prob­lem? With me? :-)
    (Sorry my English)

  • / snip­tools

    Dmitry, the prob­lem you men­tioned has noth­ing to with XSLT or Sablotron, it is more an issue of cap­tur­ing "Request" vari­ables from GET or POST form posts. Please keep ques­tions on topic.

  • / snip­tools

    Mirko, I have no idea what your ques­tion meant. Please bear with me and let me know again what you wanted to ask? Thanks.

  • mirko

    in my php ver­sion 5 rc1 there isn't the file php_xslt.dll and in the php.ini file there isn't a line with this value.
    how do i do?
    tnx and sorry for my eng­lish!
    i don't speak it very well
    bye mirko

  • Denys

    Hi,

    I tried every­thing you have men­tioned in your arti­cle, but can not start Apache. If I com­ment back the ";extension=php_xslt.dll" line, it starts fine and PHP works. When I uncom­ment the line, Apache ser­vice says 'start­ing' and never starts.

    I run Apache 2.0.49, PHP 4.3.6 on Win­dows 2003 Server Web Edition.

    Would appre­ci­ate your help.

    Denys.

  • Abhishek Koundal

    I have fol­lowed all your instruc­tions and the prob­lem that I am get­ting is when­ever I try to get the test.php run it gives me just back the code but not the info about the php.I will really appre­ci­ate if you can tell me what extra I have to do to make it work..as my apache server is run­ning well. I am using Xp-home.

  • / snip­tools

    Denys, The Sablotron bina­ries work for every­one else so it must be a prob­lem with your setup. Can I sug­gest some­thing uncom­fort­able? Backup your htdocs folder, and install Apache, PHP and Sablotron all over again fol­low­ing instruc­tions. This has always worked for me. It sounds like a lot of time, but it's the fastest way around. Espe­cially if you have "upgraded" from some ver­sion of Apache or PHP to new ones.

    Abhishek, if test.php is com­ing along as text files, then you have not asso­ci­ated ".php" exten­sion with PHP in your httpd.conf file for Apache. Please fol­low PHP instal­la­tion instruc­tions completely.

    HTH,
    Shanx

  • paul

    Thanks mate — fill­ing gaps where oth­ers can't.… worked a charm straight away.… beau­ti­fully done!

  • ahlimosa

    I have fol­low all the step that pro­vide from this site.
    here is the mes­sage that I got from the error
    when I restart the Apache
    is say this warning

    PHP Startup: ? Unable to ini­tial­ize mod­ule
    Mod­ule com­piled with mod­ule API=20020429, debug=0, thred-saftety=1
    PHP com­piled with mod­ule API=20040412, debug=0, thread-safety=1
    These options need to match

  • / snip­tools

    Hi ahlimosa, what ver­sion of PHP? What ver­sion of Apache? This does not seem to be a prob­lem with Sablotron, but with Apache and PHP them­selves, and is hence not rel­e­vant to this dis­cus­sion, but will be happy to help if I can.

  • ahlimosa

    now I am using
    Apache/2.0.50 (Win32) mod_perl/1.99_15-dev Perl/v5.8.4 PHP/4.3.7 PHP/5.0.0RC3 mod_ssl/2.0.50 OpenSSL/0.9.7d

  • / snip­tools

    Ahlimosa, your php instal­la­tion is not cor­rect. Where is your PHP.INI file located? How have you installed PHP on Apache? Have you used any instal­la­tion appli­ca­tion? Did you have PHP installed ear­lier as CGI, before installing now as a module?

  • Theo Bakker

    Thank you for this page!! It works great. I noticed a small mis­take in your test­files: in simple.php you use the complex.xml and complex.xsl ref­er­ence instead of the sim­ple ones.

    Bye, Theo

  • jkue

    I know this is a PHP4 tuto­r­ial but for those inter­ested in know­ing about this in PHP5, here is a tip. In the php.ini file remove the com­ment:
    ;extension=php_xsl.dll -> extension=php_xsl.dll

    Remem­ber your exten­sions folder!
    ;extension_dir = "c:\php\extensions" -> extension_dir = "c:\php\extensions"
    Now go here get a sam­ple of trans­for­ma­tions in PHP5(not much dif­fer­ence to the one here): http://www.php.net/manual/en/ref.xsl.php

    *NIX/linux PHP 5 includes the XSL exten­sion by default and can be enabled by adding the argu­ment –with-xsl[=DIR] to your con­fig­ure line. DIR is the libxslt instal­la­tion direc­tory, when installing man­u­ally. I installed this on FreeBSD5.2.1-RELEASE using port and mod_php5 and Win­dows XP/2003.

    Ahlimosa it seems to me, that you have two php ver­sions installed, Why? I use this ver­sion also on XP/2003 Server mine:Apache/2.0.50 (Win32) mod_perl/1.99_15-dev Perl/v5.8.4 PHP/5.0.1 mod_ssl/2.0.50 OpenSSL/0.9.7d, I placed PHP in it's own folder like C:\php (so I can update with­out rein­stalling the whole thing).

    Hope this helps.

  • Pete

    What changes to the above instruc­tions are nec­es­sary if I'm using PHP5 and XSLT in a Windows/XP environment?

    Or, is the right answer to stick with PHP4?

  • / snip­tools

    Pete, no, I rec­om­mend mov­ing on to PHP5 if pos­si­ble. Have you tried the same instructions?

  • tito Cor­dova

    como haria para insta­lar XSL en php 5.0.1 para win­dows usando apache 2, he seguido todos los pasos y no funciona

  • jkue

    tito this does func­tion on XP, Apache2 with PHP5.0.1. All you need to actu­ally do is uncom­ment:
    ;extension=php_xsl.dll -> extension=php_xsl.dll
    use the sam­ples from Shanx or here(http://www.php.net/manual/en/ref.xsl.php)And you're good to go, it may also help to restart the service(Apache2), then it should work(I use it).

  • Mark

    PHP Startup: Unable to load dynamic library '(Location)\php_xslt.dll' — The spec­i­fied mod­ule could not be found.

  • monty

    Sablotron error on line 289:'XML parser error 4: not
    well-formed (invalid token)'.

  • jkue

    Mark and Monty state your prob­lems clearer, so you may(if pos­si­ble) receive some assis­tance, oth­er­wise your com­ments makes no sense at all. Please guys read the "Whole" thread you may be miss­ing something(referring to your errors). One error show an invalid doc­u­ment and the other, an exten­sion ref­er­ence prob­lem, which are both han­dled in this thread.

  • Heinz

    Hi,

    both PHP code exam­ples work on my local machine,
    how­ever how could one process an XML file of the fol­low­ing for­mat with XSLT and PHP ?

    XML file (exam­ple)
    http :// http://www.domain.com / xml.asp&id=12&row=45

    Thanks

  • erkko

    prob­lem, at least for me, seams to be not copy­ing expat dll-s to PATH. Thanks, now its working :)

    — —  —  —  —  — —
    2. Then, grabbed the lat­est expat_win32bin from http://sourceforge.net/project/showfiles.php&group_id=10127&;release_id=136025 and 'installed' it (it's an exe). From the instal­la­tion folder, grabbed the expat.dll and libexpat.dll and copied them into system32 as well. (PS — libexpat.dll is not new).

  • Mike

    Hey I just like to thank you for this great resource it has helped me no end to resolve the issues I was hav­ing to get Sablotron work­ing on my sys­tem. Spe­cial thanks to JKue com­ments 60 and 61.

    Cheers Mike

  • Sina

    Has any­one gen­er­ated Doc­Book Web­site out­put using this method?

  • Rinkeyreg­gae

    Con­cern­ing plac­ing dlls in your system32 folder.

    I had a prob­lem with apache not find­ing my mod­ules while they were at the exact loca­tion as spec­i­fied. Prob­lem solved as I put php5ts.dll in the system32 folder. Turns out the other dlls need this one and it needs to be in the sys­tem path. I Sup­pose if you put the dir where php5ts.dll orig­i­nally is in the path it will also work.

  • foxvin

    Hi thanks for giv­ing the instruc­tion on how to con­fig­ure the xslt. I just have 1 prob­lem, my php 4 is ok and work­ing prop­erly. But I also what to use xslt exten­sion under php 5 but when I fol­low the same instruc­tion it did not work on php 5 because the php_xslt.dll i have is i think design for php 4 only can u help me find php_xslt.dll for php 5.

    thanks

  • philip ray

    Thanks you for the pro­ce­dure to over­come my prob­lem, but still i need some tips to gen­er­ate a pow­er­ful index. because i use xslt and xml for this document.

  • edi

    If it still doesn't work and you did what this tuto­r­ial says, try copy­ing expat.dll, iconv.dll and sablot.dll to your sys­tem folder (c:\window\system32 on my pc).
    I found these dlls in the 'dlls' folder of my php distribution.

  • mogyi

    When you begin des­per­ately copy­ing files into C:\WINDOWS\system32 .. and still not see­ing any results try to begin with iconv.dll !
    Nor­mally you should NOT copy php4ts.dll, that should reside in the default php instal­la­tion folder.

  • noob

    Hi. Get­ting a prob­lem when try­ing to run Apache 1.3.. I got win 98 as an OS. The error mes­sage in the Prompt is like this:

    [warn] No such file or direc­tory: exec> may not be safe

    Under that it says:

    Apache/1.3.33 PHP/4.3.10 running…

    It seems ok, but then when I try to make a sim­ple PHP test and start­ing in the browser with 'http://localhost/test.php', then the WHOLE code shows up, NOT only the 'echo' in the PHP code, as it should be. so that is the prob­lem for me.. you know what the prob­lem could be?

  • Paulo Basto

    how to enable sablotron XSLT on your TSW server
    You don't need to down­load any­thing. TSW has every­thing you need, it just needs a lit­tle tweaking 😉

    I copied essen­tial files from the php folder to windows\system32

    sablot.dll
    expat.dll
    php4ts.dll
    php_xslt.dll

    checked first if php was being loaded as a mod­ule on the apache.conf there should be an entry like this:

    Load­Mod­ule php4_module

    checked also on \\localhost\php.info to see if every­thing was all­right. There you should see this line:

    PHP Ver­sion 4.3.8

    Con­fig­u­ra­tion File (php.ini) Path C:/TSW/Apache2/conf/php.ini

    — — —  —  —  —  —  —  —  —  — –

    Now that you know where php.ini resides, go and remove this com­ments in it:

    OLD LINE –> ;extension=php_xslt.dll
    NEW LINE –> extension=php_xslt.dll

    did the same for php_iconv.dll (though i don't think its mandatory)

    –Under PATHS AND DIRECTORIES, ADDED this path lines:

    include_path = ".;C:\TSW\Apache2\php\"
    include_path = ".;C:\WINDOWS\system32\"

    Though i dont think it was nec­es­sary (heck! I dont even know if its really nec­es­sary to copy the .dll files to sys32!!).
    Its work­ing now, and thats what mat­ters… for now :)

    — — —  —  —  —  —  —  —  —  —  —  —  —  — –

    Then finally my last and deci­sive step was edit­ing php_handler.conf located in C:\TSW\Apache2\conf\mods, uncom­ment­ing the following:

    PHPINI­Dir conf/php.ini

    Load­File dll/sablot.dll
    Load­File dll/libintl-1.dll
    Load­File dll/gds32.dll
    Load­File dll/libmhash.dll
    Load­File php/pdflib.dll

    AddType application/x-httpd-php .php .php3 .info
    AddType application/x-httpd-php-source .phps

    ——

    In the end your php.ini out­put should have this extra fields:

    xml
    XML Sup­port active
    XML Name­space Sup­port active
    EXPAT Ver­sion 1.95.6

    xslt
    XSLT sup­port enabled
    Back­end Sablotron
    Sablotron Ver­sion 1.0

    Ready to rock!?? I am… :)

  • Peter Ruz­icka

    Thank You!
    This arti­cle is very helpfull.

  • marek

    my ques­tion is if it is posi­ble to run xslt on XAMPP and how to do that?
    Thank You.

  • jarra

    thank you.
    it helped me a lot!
    cheers

  • Dave

    I was just won­der­ing, as I'm new to XSLT, can a per­son use it with­out an xsl stylesheet? — I have an exist­ing stylesheet I'd like to use — a css, is there either a way to ref­fer­ence that instead, or to con­vert my css to xsl?

  • Moe

    Syn­tax error on line 519 of C:/Program Files/Apache Group/Apache2/conf/httpd
    f:
    Can­not load C:/PHP/sapi/php4apache.dll into server: The spec­i­fied mod­ule cou
    ot be found.
    Note the errors or mes­sages above, and press the key to exit. 17…

  • boo­boop

    I've neen try­ing to do every­thing accord­ing to
    the instruc­tions above->Windows xp, Apache2,
    php 4.3.10.But XSLT had not been added to the php info page and the code for run­ning a test didn't work.
    Also accord­ing to some instruc­tions in the php
    home­page I've moved php.ini to the php folder
    (c:/php/) and changed the extension_dir to
    c:/php/extensions/ (remov­ing the dll's from the SYSTEM32 folder)
    and moved the';' from extension=php_xslt.dll
    things are not work­ing !
    Any suggestion ?

  • Leonardo Chin­chilla

    Hello,

    I does, every step, but I have the fol­low­ing error when start the apache server: Unable to load dynamic library './php_sxl.dll"

    Regards

  • JP

    Hi there

    I have con­fig­ured PHP Ver­sion 5.0.4 on win­dows. Every­thing seems to work fine except
    $xh = xslt_create();

    Fatal error: Call to unde­fined func­tion xslt_create().

    In your tuto­r­ial you have sug­gested
    "open your PHP.INI and uncom­ment the php_xslt.dll extension"

    But i dont have any such line, instead i have php_xsl.dll, which i uncom­mented but no success.

    Kindly sug­gest for this new verion of PHP.

    Regards

  • jkue

    JP, Sim­pleXML is builtin and has (my opin­ion) eas­ier imple­men­ta­tion. Exam­ple below.

    — XML FILE: test.xml —
    <?xml version="1.0"?>
    <human>
    <per­son>
    <firstname>Henry</firstname>
    <lastname>Connor</lastname>
    <email>[email protected]</email>
    </person>

    — PHP CODE —
    <?php>
    $human = simplexml_load_file('./test.xml');
    foreach($human->person as $per­son) {
    echo 'Firstname:'.$person->firstname;
    echo 'Lastname:'.$person->lastname;
    echo 'Email:'.$person->email;
    }
    ?>

    The rest is up to your imag­i­na­tion, hope this helps some.

  • / snip­tools

    Jkue, thanks for the con­tri­bu­tion, I believe your code was caught up in our cor­rec­tion facil­ity. Please mail me the code at shanx at snip­tools dot com and I'll put it up here. Cheers!

  • jkue

    Was sent today Shanx.

  • Aris­tidis

    hello,
    When I am writ­ting in httpd.conf the load mod­ule and restart apache2 server it appears a warn­ing
    can not load c:/php/sapi/php4apache2.dll to the server
    regards

  • burhan

    i m using php 5 . there is no xslt.dll writ­ten in php.ini. and your code error is
    Fatal error: Call to unde­fined func­tion xslt_create() in c:\webs\test\xsltest\complex.php on line 8
    reply me plz

  • PAblo

    There is no XSLT Sup­port in PHP5, you have to use DOM instead, or down­grade to PHP4

  • / snip­tools

    Hi Pablo, that's not entirely accu­rate. PHP5 does have XSLT sup­port although that's been moved to PECL. There's more info here: http://www.php.net/manual/en/ref.xslt.php

    Quote:
    Note: This exten­sion has been moved to the PECL repos­i­tory and is no longer bun­dled with PHP as of PHP 5.0.0. If you need xslt sup­port with PHP 5 you can use the XSL exten­sion.

    That said, I agree with your gen­eral idea, using Dom­Doc­u­ment is a lot faster on most systems.

  • Lee

    I've installed Apache2, PHP and MySQL under WinXP. I'm run­ning an XSLT trans­for­ma­tion from a small PHP file and PHP won't resolve the urls of the files involved cor­rectly. I put "xml_file.xml" and "xsl_file.xsl" in the script for XSLT to work with, and the script tries to resolve the file URLs as c:\PHP\xml_file.xml, etc. even though the html pages cor­rectly resolve par­tial urls to the htdocs dir under Apache. I think this is the prob­lem with the XSL trans­for­ma­tion com­ing up with the generic "invalid token". Am I miss­ing some­thing in the PHP.ini that's caus­ing the error in resolv­ing the urls? Any ideas would be very helpful!

  • Lee

    For­get what I just posted. After down­load­ing your sam­ple files and find­ing that they worked just fine. My prob­lem was the xslt_set_base com­mand (I didn't have one). Once I tore apart your file, I see that the file:// url had to be used instead of point­ing at my server http:// url.

  • jirka

    hi, thanks a lot, after 2 days of search­ing this was the only ! work­ing method :-)

  • /tutorials/sablotron-xslt-php-apache-on-windows-and-a-basic-xslt-tutorial#postcomment anu

    every thing works fine.except tht when i run my apache4 ..,it says unable to load the module.the exact error is.…
    can­not load c:/php/php4apache2.dllinto server…the spec­i­fied mod­ule could not be found

  • / snip­tools

    Anu, I guess you meant PHP4, not Apache4. That's the most com­mon error peo­ple see when they have not fol­lowed install instruc­tions that come with PHP.

  • http://www.prexactly.com tom

    from http://qa.php.net/ and unzip
    doesn't seem to have any ver­sions for win­dows -
    I've found many ver­sions of how to get xslt to work with win­dows — all slightly dif­fer­ent but
    doesn't seem to work with PHP 5+
    using sablot expat and plac­ing the appro­pri­ate .dll files in the right places, mak­ing con­fig changes see straight for­ward but all the doc i reads slightly con­tra­dicts and seems to be a year or 2 old.

  • sparky__

    I'm using PHP Ver­sion 4.4.2 with IIS using ISAPI.

    I got it all work­ing in my win­dows xp machine but i copy it to my w2003 machine(s) , the xslt wont appear at all in the phpinfo!!!
    xslt:
    XSLT sup­port enabled
    Back­end Sablotron
    Sablotron Ver­sion 1.0

    Also for some rea­son the Con­fig­u­ra­tion File (php.ini) Path is C:\WINDOWS\php.ini inst­stead of C:\WINDOWS\system32\php.ini as it was in xp ?!?!

    It's read­ing the ini (now i put it c:\windows instead) because i've changed the highlight.bg as a test.. when­ever i change it in the ini and restart iis this updates but the xslt just wont include.. im not sure why as all the set­tings are the same. [this was after fail­ing to get it to work in either with php5 so scrap­ping that all and going back to 4 beause the app my client uses needs it] with that darned "Fatal error: Call to unde­fined func­tion: xslt_create()" which i only worked out was an incom­pat­i­bil­ity issue with php 5 prob by com­ing here.. so cheers for get­ting me this far!!!

    I've even tried hav­ing the copy­ing the php4ts.dll in sys32 and win­dows to hedge my bets to no avail.

  • almas

    i am get­ting inter­nal server error and when i start apache con­sole the i get 2 screens one which is empty and gets closed very rapidly and another with fol­low­ing lines

    [Sat Mar 04 22:46:19 2006] [warn] (2)No such file or direc­tory: exec() may not be safe
    Apache/1.3.31 (Win32) running…

  • Ryan Hen­nessy

    Hello, I'm a devel­oper with a man­aged server so I don't know much about servers. We have a trade show com­ing up and need to run our site off of a lap­top and your tuto­r­ial on set­ting up xslt/sablotron for win­dows saved me. Thanks,
    Ryan

  • N Hamayun

    Yes , your page has proved to me a lit­tle help­full.
    as i am using Apache/2.0.59 (Win32) PHP/5.1.6 , and there is no php_xslt.dll file in the ext folder of php but i found on php site file named php_xsl.dll will be used for xslt pur­pose so i tried what­ever you said using this file. while using phpinfo(); method it shows the xsl sup­port but when i browse your sam­ple pages they donot show any thing except fatal error of xslt_create() not found at line at.
    please help me out as i am strug­gling to do my final year project and time is run­ning out.
    also please note my php folder is c:\php and for apache is c:\Apache2

  • Ste­fan

    Hello,
    I have a prob­lem, I can't con­fig­ure my PHP 4.4 under Apache 2.2 with exsl suport. Can you help me?
    In phe.ini I have xsl, domxml sup­port, but no exsl support.

    Thank you

  • Javier

    Hi, I'm try­ing to use XSL on PHP5, but when I exe­cuted phpinfo() it don't show me that I have installed the exten­sion XSL, I already tried with this too " – with-xsl[=C:\wamp\php\ext]" in the PHP.INI but it don't work, Any Idea? Sorry for the trou­bles and Thank you for your support.

  • John

    I am just post­ing what my fix to this mess was. I am using XP SP2, apache 2, and php > 4.2.

    I was unable to get phpinfo() to show any proof that the xslt exten­sion was work­ing. I noticed that the php.ini loca­tion at the top just said C:\Windows\ and noth­ing else. So, I looked in my apache con­fig and noticed that my PHPIni­Dir was point­ing to /php, so to fix it, I changed it to C:/apache/php/php.ini And, like magic, it worked.

  • satyen­dra Thakur

    Hi i am using php 5 and apache 2.2x get­ting error
    "can't locate API mod­ule struc­ture 'php_module' in file "c:/php/php5apache2_2_dll: No error

    Please help me out or send me how to con­fig­ure it?