SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    ********* Articles ArticleBot's Avatar
    Join Date
    Apr 2001
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Article Discussion

    This is an article discussion thread for discussing the SitePoint article, "Transform your PHP with XSLT"

  2. #2
    SitePoint Guru hgilbert's Avatar
    Join Date
    Dec 2004
    Location
    London
    Posts
    839
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Interesting article.

    Now I am really glad I've being using XML/XSLT extensivelly on my ASP.NET.

    That means I could port my websites to Apache/PHP with minimal fuss.

    Or maybe not .. just realized! I use MS SQL Stored Procedures extensivelly too - and that can't be ported to MySQL without a lot of fuss.

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    OK
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I take it PHP doesn't support that?
    God Bless,
    Jake

    My Blog -- www.mission36teen.com

  4. #4
    Anonymous
    SitePoint Community Guest
    Very very useful article, and the best part is the example works!! Thanks!

  5. #5
    SitePoint Guru worchyld's Avatar
    Join Date
    Jul 2003
    Location
    Newcastle upon Tyne
    Posts
    909
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried this and got salbotron, etc installed - but firstly -- it keeps referring to c:\php\docbook.php -- how do I change this to see my 127.0.0.1 automatically?

    Secondly, I hardcoded the path to see what would happen and I get this error;

    XSLT processing error: XML parser error 4: not well-formed (invalid token)
    On php.net it says the files have to be saved as UTF-8, which I've done -- but it still comes up with the errors.

    How do I fix these two issues?

  6. #6
    SitePoint Guru worchyld's Avatar
    Join Date
    Jul 2003
    Location
    Newcastle upon Tyne
    Posts
    909
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I looked on the net and found that sniptools has a range of salbotron xslt+xml examples which work perfectly and I was able to adapt one of the more "simplier" demos to make this code work properly.

    Sniptools website:
    http://sniptools.com/vault/sablotron...t-tutorial.htm

    Code:
    <?php
    # Adapted docbook.php
    
    // Xml and XSL files
    $xml_file = "docbook.xml";
    $xsl_file = "docbook.xsl";
    
    // Allocate a new XSLT processor
    $xh = xslt_create();
    $fileBase = 'file://' . getcwd () . '/';
    xslt_set_base ( $xh, $fileBase );
    
    // Process the document
    $result = xslt_process($xh, $xml_file, $xsl_file);
    if (!$result) {
        // Something croaked. Show the error
        echo 'XSLT processing error: ' .xslt_error($xh) ;
    }
    else {
        // Output the resulting HTML
        echo $result;
    }
    
    // Destroy the XSLT processor
    xslt_free($xh);
    
    ?>

  7. #7
    Wepiha Te Ata
    SitePoint Community Guest
    Sadly, this code is a little redundant for php5 (or it was in my case anyway):

    See //http://www.php.net/manual/ref.xsl.php particularly //http://www.php.net/manual/ref.xsl.php#45415


  8. #8
    SitePoint Guru
    Join Date
    Jul 2004
    Location
    Netherlands
    Posts
    672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What i don't understand is how is this better then a "normal" template engine, this is allot more confusing creating a new template because of all the extra tags.

    Also what is the advantage of storing articles in xml, will a database not have faster performance then a xml doc, this would get really large at some point right?

    Could somebody explain to me the real advantages for xml and xlst? Apart from RSS feeds?
    Go visit my site :-D you know you want to ;-)
    www.mech7.net

  9. #9
    Andrew
    SitePoint Community Guest
    I think the advantage is that you can also push this rendering out to the client, enabling rich web apps like gmail without the fuss of writing two templates(one for the server to render, and another for the client to render)

  10. #10
    Christian
    SitePoint Community Guest
    Hello, I tried to follow the installation but I got an error while trying the code in page 3 !

    Seems that I lack of php_xslt.dll, where to find it ? I have downloaded expat and sablotron, and searched for php_xslt.dll, but can't find any !

    Thanks !

  11. #11
    Anon
    SitePoint Community Guest
    I have to find out the hard way but it should be noted that "php_xslt.dll" is only included in php 4 versions and lower it is not included or supported in php5 or higher.

  12. #12
    SitePoint Member
    Join Date
    Jul 2006
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i cant find sablotron anyone knows where i can find this?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •