Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    Jul 2005
    Posts
    39
    Member #
    10659
    Why? My server has PHP Version 5.0.5 and libXML Version 2.6.11, although I do not see any specfic mention of libXSLT. From everything I read it seems like the XSLTProcessor is a standard feature in PHP5.
    This is my php code.
    PHP Code:
    <?php

    /* load the xml file and stylesheet as domdocuments */
    $xsl = new DomDocument();
    $xsl->load("test.xsl");
    $inputdom = new DomDocument();
    $inputdom->load("test.xml");

    /* create the processor and import the stylesheet */
    $proc = new XsltProcessor();
    $xsl $proc->importStylesheet($xsl);
    $proc->setParameter(null"titles""Titles");

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

    ?>
    This is the xml file
    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!-- Edited with XML Spy v4.2 -->
    <catalog>
    	<cd>
    		<title>Empire Burlesque</title>
    		<artist>Bob Dylan</artist>
    		<country>USA</country>
    		<company>Columbia</company>
    
    		<price>10.90</price>
    		<year>1985</year>
    	</cd>
    	<cd>
    		<title>Hide your heart</title>
    		<artist>Bonnie Tyler</artist>
    		<country>UK</country>
    
    		<company>CBS Records</company>
    		<price>9.90</price>
    		<year>1988</year>
    	</cd>
    	<cd>
    		<title>Greatest Hits</title>
    		<artist>Dolly Parton</artist>
    
    		<country>USA</country>
    		<company>RCA</company>
    		<price>9.90</price>
    		<year>1982</year>
    	</cd>
    	<cd>
    		<title>Still got the blues</title>
    
    		<artist>Gary Moore</artist>
    		<country>UK</country>
    		<company>Virgin records</company>
    		<price>10.20</price>
    		<year>1990</year>
    	</cd>
    
    	<cd>
    		<title>Eros</title>
    		<artist>Eros Ramazzotti</artist>
    		<country>EU</country>
    		<company>BMG</company>
    		<price>9.90</price>
    
    		<year>1997</year>
    	</cd>
    	<cd>
    		<title>One night only</title>
    		<artist>Bee Gees</artist>
    		<country>UK</country>
    		<company>Polydor</company>
    
    		<price>10.90</price>
    		<year>1998</year>
    	</cd>
    	<cd>
    		<title>Sylvias Mother</title>
    		<artist>Dr.Hook</artist>
    		<country>UK</country>
    
    		<company>CBS</company>
    		<price>8.10</price>
    		<year>1973</year>
    	</cd>
    	<cd>
    		<title>Maggie May</title>
    		<artist>Rod Stewart</artist>
    
    		<country>UK</country>
    		<company>Pickwick</company>
    		<price>8.50</price>
    		<year>1990</year>
    	</cd>
    	<cd>
    		<title>Romanza</title>
    
    		<artist>Andrea Bocelli</artist>
    		<country>EU</country>
    		<company>Polydor</company>
    		<price>10.80</price>
    		<year>1996</year>
    	</cd>
    
    	<cd>
    		<title>When a man loves a woman</title>
    		<artist>Percy Sledge</artist>
    		<country>USA</country>
    		<company>Atlantic</company>
    		<price>8.70</price>
    
    		<year>1987</year>
    	</cd>
    	<cd>
    		<title>Black angel</title>
    		<artist>Savage Rose</artist>
    		<country>EU</country>
    		<company>Mega</company>
    
    		<price>10.90</price>
    		<year>1995</year>
    	</cd>
    	<cd>
    		<title>1999 Grammy Nominees</title>
    		<artist>Many</artist>
    		<country>USA</country>
    
    		<company>Grammy</company>
    		<price>10.20</price>
    		<year>1999</year>
    	</cd>
    	<cd>
    		<title>For the good times</title>
    		<artist>Kenny Rogers</artist>
    
    		<country>UK</country>
    		<company>Mucik Master</company>
    		<price>8.70</price>
    		<year>1995</year>
    	</cd>
    	<cd>
    		<title>Big Willie style</title>
    
    		<artist>Will Smith</artist>
    		<country>USA</country>
    		<company>Columbia</company>
    		<price>9.90</price>
    		<year>1997</year>
    	</cd>
    
    	<cd>
    		<title>Tupelo Honey</title>
    		<artist>Van Morrison</artist>
    		<country>UK</country>
    		<company>Polydor</company>
    		<price>8.20</price>
    
    		<year>1971</year>
    	</cd>
    	<cd>
    		<title>Soulsville</title>
    		<artist>Jorn Hoel</artist>
    		<country>Norway</country>
    		<company>WEA</company>
    
    		<price>7.90</price>
    		<year>1996</year>
    	</cd>
    	<cd>
    		<title>The very best of</title>
    		<artist>Cat Stevens</artist>
    		<country>UK</country>
    
    		<company>Island</company>
    		<price>8.90</price>
    		<year>1990</year>
    	</cd>
    	<cd>
    		<title>Stop</title>
    		<artist>Sam Brown</artist>
    
    		<country>UK</country>
    		<company>A and M</company>
    		<price>8.90</price>
    		<year>1988</year>
    	</cd>
    	<cd>
    		<title>Bridge of Spies</title>
    
    		<artist>T`Pau</artist>
    		<country>UK</country>
    		<company>Siren</company>
    		<price>7.90</price>
    		<year>1987</year>
    	</cd>
    
    	<cd>
    		<title>Private Dancer</title>
    		<artist>Tina Turner</artist>
    		<country>UK</country>
    		<company>Capitol</company>
    		<price>8.90</price>
    
    		<year>1983</year>
    	</cd>
    	<cd>
    		<title>Midt om natten</title>
    		<artist>Kim Larsen</artist>
    		<country>EU</country>
    		<company>Medley</company>
    
    		<price>7.80</price>
    		<year>1983</year>
    	</cd>
    	<cd>
    		<title>Pavarotti Gala Concert</title>
    		<artist>Luciano Pavarotti</artist>
    		<country>UK</country>
    
    		<company>DECCA</company>
    		<price>9.90</price>
    		<year>1991</year>
    	</cd>
    	<cd>
    		<title>The dock of the bay</title>
    		<artist>Otis Redding</artist>
    
    		<country>USA</country>
    		<company>Atlantic</company>
    		<price>7.90</price>
    		<year>1987</year>
    	</cd>
    	<cd>
    		<title>Picture book</title>
    
    		<artist>Simply Red</artist>
    		<country>EU</country>
    		<company>Elektra</company>
    		<price>7.20</price>
    		<year>1985</year>
    	</cd>
    
    	<cd>
    		<title>Red</title>
    		<artist>The Communards</artist>
    		<country>UK</country>
    		<company>London</company>
    		<price>7.80</price>
    
    		<year>1987</year>
    	</cd>
    	<cd>
    		<title>Unchain my heart</title>
    		<artist>Joe Cocker</artist>
    		<country>USA</country>
    		<company>EMI</company>
    
    		<price>8.20</price>
    		<year>1987</year>
    	</cd>
    </catalog>
    This is the XSLT file
    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!-- Edited with XML Spy v4.2 -->
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      <title>XSL through PHP Test</title>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      </head>
      <body>
        <h2>My CD Collection</h2>
        <table border="1">
          <tr bgcolor="#9acd32">
            <th>Title</th>
    
            <th>Artist</th>
          </tr>
          <xsl:for-each select="catalog/cd">
          <tr>
            <td><xsl:value-of select="title"/></td>
            <td><xsl:value-of select="artist"/></td>
          </tr>
          </xsl:for-each>
        </table>
    
      </body>
      </html>
    </xsl:template>
    </xsl:stylesheet>
    And "Fatal error: Class 'XsltProcessor' not found in ...blahBlah\xslTest\displayTest.php on line 10 is the response that I get from my server. I am not the admin so I cannot freely install whatever I want, but I am hoping that the solution is simple. I could stand to brush up on my PHP although I only intended on light use of it in my project.

  2.  

  3. #2
    Senior Member straight_up's Avatar
    Join Date
    Dec 2003
    Location
    Pennsylvania/Arizona
    Posts
    601
    Member #
    4309
    Ever figure out what was wrong?
    I am Alan Hogan (@alanhogan on Twitter). I like PHP, UI/UX design, and OS X.

  4. #3
    Member
    Join Date
    Jul 2005
    Posts
    39
    Member #
    10659
    I think it wasn't installed or something. I don't remember, all I remember is that I had to use JS to do the XSL stuff and that sucked. Generating XHTML pages with JS in them, from XML files, using XSL through an in browser XSL processor causes a lot escape character headaches.

  5. #4
    Senior Member straight_up's Avatar
    Join Date
    Dec 2003
    Location
    Pennsylvania/Arizona
    Posts
    601
    Member #
    4309
    Got it. Thanks. I can only imagine the escape character problems.
    I am Alan Hogan (@alanhogan on Twitter). I like PHP, UI/UX design, and OS X.

  6. #5
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Sablotron must be configured in your Apache install.

    To prevent escape character problems in XSL-T, use a CDATA block.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:40 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com