SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    toronto
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP and XSLT 2.0

    i am using this PHP code to output an XML / XSLT transformation into html:

    PHP Code:
    Function ShowRSS($xml_file$xsl_file){

    $xsl DOMDocument::load($xsl_file);
    $xml DOMDocument::load($xml_file);

    //create the processor and import the stylesheet
    $proc = new XsltProcessor(); 
    $xsl $proc->importStylesheet($xsl);

    //transform and output the xml document
    $newdom $proc->transformToDoc($xml); 
    print 
    $newdom->saveXML(); 

    }

    ShowRSS('xml/tor.xml''xsl/info.xsl'); 

    it works great with XSLT 1.0 and 1.1, but when i switch the XSLT version declaration to 2.0 i get this error:
    PHP Warning: XSLTProcessor::importStylesheet() [function.importStylesheet]: compilation error: file file:///D%3A/xsl/info.xsl line 2 element stylesheet in D:\ssi_xml.php on line 13 PHP Warning: XSLTProcessor::importStylesheet() [function.importStylesheet]: xsl:version: only 1.0 features are supported in D:\ssi_xml.php on line 13


    any ideas on how i can use XSLT 2.0 with my code?



    thanks.

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You'll probably need to use an outside XSLT processor. I don't think LibXML/LibXSLT/LibEXSLT support 2.0 yet.

  3. #3
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP 5 uses libxslt which only supports the v1.0 XSLT standard. Saxon is the dominant processor but it only supports .NET and Java. Altova recently released a free v2.0 compliant processor. It too supports .NET and Java. It also supports command line and .COM but only runs on Windows.

    Xalan, libxslt, et all don't seem to be motivated to do a v2.0 XSLT release.

    So unless you want to go to a Windows box to do .NET with ASP.NET, use PHP with COM, or switch to Java, you are pretty much stuck in XSLT 1.0 land.
    Kerry Kobashi


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
  •