rlbewick Posted January 23, 2010 Share Posted January 23, 2010 I have some xml schema that looks like the following: <OfferTextdetails><ul> <li>Earn more cash in more ways than anyone else(SM) <li>Unlimited cash rewards, automatically <li>Up to 20% <em>Cashback Bonus®</em> when you shop online <li>Double rewards with more than 100 <em>Cashback Bonus</em> Partners <li>Customer Service in less than a minute, anytime you want <li>0% Intro APR for 6 months on Purchases, and up to 12 months on Balance Transfers* <p></p> </li></ul></OfferTextdetails> When I display the text as html with the following code it displays the tags instead of applying them to the output. <td id="tdcontent" colspan="4" width="478"><xsl:for-each select="$XML"> <xsl:for-each select="AffiliateAccountOffers"> <xsl:for-each select="OfferDetails"> <xsl:for-each select="OfferTextdetails[../OfferId='56']"> <xsl:apply-templates/> </xsl:for-each> </xsl:for-each> </xsl:for-each> </xsl:for-each></td> How can I make this display correctly with the tags being functional? Link to comment Share on other sites More sharing options...
Martin Honnen Posted January 23, 2010 Share Posted January 23, 2010 Your only chance is disable-output-escaping <xsl:for-each select="OfferTextdetails[../OfferId = '56']"> <xsl:value-of select="." disable-output-escaping="yes"/></xsl:for-each> Note that disable-output-escaping is an optional serialization feature not supported by all XSLT processors. For instance if you do client-side XSLT in the browser then Firefox/Mozilla does not support it as it does not serialize the result tree of the transformation, it directly renders it. Link to comment Share on other sites More sharing options...
rlbewick Posted January 23, 2010 Author Share Posted January 23, 2010 Your only chance is disable-output-escaping<xsl:for-each select="OfferTextdetails[../OfferId = '56']"> <xsl:value-of select="." disable-output-escaping="yes"/></xsl:for-each> Note that disable-output-escaping is an optional serialization feature not supported by all XSLT processors. For instance if you do client-side XSLT in the browser then Firefox/Mozilla does not support it as it does not serialize the result tree of the transformation, it directly renders it. Well that just sucks, I see the same result in Firefox 3.5 and IE 8. Guess I'll have to move to server side. I am running from a Linux host, is there anything I need to do to enable XSLT processing. I know this goes into another forum, just point me in the right direction, thanks. Link to comment Share on other sites More sharing options...
boen_robot Posted January 24, 2010 Share Posted January 24, 2010 Well that just sucks, I see the same result in Firefox 3.5 and IE 8. Guess I'll have to move to server side. I am running from a Linux host, is there anything I need to do to enable XSLT processing. I know this goes into another forum, just point me in the right direction, thanks.You should ask your host about that. Usually, they don't allow users to solely enable extensions. If they do allow you to - uncomment the "XSL" exntesion from your php.ini. Link to comment Share on other sites More sharing options...
rlbewick Posted January 25, 2010 Author Share Posted January 25, 2010 You should ask your host about that. Usually, they don't allow users to solely enable extensions. If they do allow you to - uncomment the "XSL" exntesion from your php.ini.I talked with my host and I was told I can create a php.ini myself and add the directives that I need. I currently do not have a php.ini. What directives should I include to make this transformation?I have a .htacess file with the following code..AddHandler ax .xmlAddHandler application/xml .xml .xsl .xslt Link to comment Share on other sites More sharing options...
boen_robot Posted January 27, 2010 Share Posted January 27, 2010 The .htaccess doesn't have anything to do with it in this case (I think...).Create a file named php.ini, and it it, add extension=php_xsl.dll (if your host is a Windows one)or perhaps extension=php_xsl.so (if your host is a Linux one)If that doesn't work, contact them again, asking what you should put in your php.ini to enable the extension (or any extension for that matter). Link to comment Share on other sites More sharing options...
rlbewick Posted January 28, 2010 Author Share Posted January 28, 2010 The .htaccess doesn't have anything to do with it in this case (I think...).Create a file named php.ini, and it it, addextension=php_xsl.dll (if your host is a Windows one)or perhaps extension=php_xsl.so (if your host is a Linux one)If that doesn't work, contact them again, asking what you should put in your php.ini to enable the extension (or any extension for that matter). Ok, I was very wrong on my last post. I do have a php.ini but there is no reference xsl. I have submitted a ticket to my host after talking with four lower level tech that did not know much more than me. I have since changed my .htaccess file to..#Redirect Not found to 404.shtmlErrorDocument 404 /404.shtml#Emulate IE7 HeaderHeader set X-UA-Compatible "IE=EmulateIE7"#Parse XML as PHPAddType application/xml .php#Parse PHP as XMLAddType application/php .xml But, as you know that did not correct the problem. Have I taken a step forward or not? I'll try to add.. extension=php_xsl.so Yes, I am running a Linux host.Thanks boen_robot Link to comment Share on other sites More sharing options...
boen_robot Posted January 29, 2010 Share Posted January 29, 2010 Remove the parts: #Parse XML as PHPAddType application/xml .php#Parse PHP as XMLAddType application/php .xml They only "break" normal XML files, and don't help with anything.As for the extension... php_xsl.so is only how it happens on some Linux systems, but certainly not all. The quesiton you need to ask your host really is where is their extension_dir (and I mean the full path), and how are the extension files named like (if not any extension, at least this one).Your php.ini should then include extension_dir = "/whatever/path/they/say/their/extensions/are/in"extension=whatever_they_say_extension_files_are_named_like BTW, I'd stay away (or move) from a host which can't enable any kind of an extension on their own servers ('cause this is really about how to enable any extension, not just this one)... not allowing you to do it is OK. Not wanting to do it ("for security and/or compatibility reasons") is also OK. But not knowing how to do it?!? Nah... Link to comment Share on other sites More sharing options...
rlbewick Posted January 29, 2010 Author Share Posted January 29, 2010 Remove the parts:#Parse XML as PHPAddType application/xml .php#Parse PHP as XMLAddType application/php .xml They only "break" normal XML files, and don't help with anything.As for the extension... php_xsl.so is only how it happens on some Linux systems, but certainly not all. The quesiton you need to ask your host really is where is their extension_dir (and I mean the full path), and how are the extension files named like (if not any extension, at least this one).Your php.ini should then include extension_dir = "/whatever/path/they/say/their/extensions/are/in"extension=whatever_they_say_extension_files_are_named_like BTW, I'd stay away (or move) from a host which can't enable any kind of an extension on their own servers ('cause this is really about how to enable any extension, not just this one)... not allowing you to do it is OK. Not wanting to do it ("for security and/or compatibility reasons") is also OK. But not knowing how to do it?!? Nah... "Ok, I commented out the AddType application/s as you stated above. I contacted my host and the following was the response:This is already installed for you, is there a specific xsl error your getting? If theres anything else we can assist you with please let us know and we'll be glad to help.[root@gator353 ~]# /usr/bin/php -m|grep ^xslxslRegards,Billy Harrison Jr.Linux Systems Administrator"The xml/xsl transformation still display the same with the code tags being displayed in both IE 8 and Firefox 3.6 & 3.5.7. I have removed disable output escaping since it does not work in Gecko based browsers anyway. Am I missing something here?And then I received another reply:"These are the php extension available on the server. Are any of these what you are looking for?libxslt Version => 1.1.24libxslt compiled against libxml Version => 2.7.3libexslt Version => 1.1.24You may request that we install additional php extensions. Our decision to install or not to install is based on on the nature of the extension. If the extension you are looking for is not one of the already installed extensions, please give me the exact pecl name so that we may look it up and make a decision.Regards,Eric C.GNU Linux Systems Administrator"So different answers to the same question, what you think? Link to comment Share on other sites More sharing options...
boen_robot Posted February 5, 2010 Share Posted February 5, 2010 It appears like Eric is the one in the hosting company who actually knows how to deal with PHP (I assume other people answered you before). Either that, or only now he has realized what you are asking for.It appears the XSL extension has been enabled, and they tell you to actually try it, and report any error messages you have if it doesn't work.If it doesn't work, I'd suggest that you try running <?php phpinfo() ?> and show them the contents in addition to reporting any error messages. Link to comment Share on other sites More sharing options...
rlbewick Posted February 11, 2010 Author Share Posted February 11, 2010 It appears like Eric is the one in the hosting company who actually knows how to deal with PHP (I assume other people answered you before). Either that, or only now he has realized what you are asking for.It appears the XSL extension has been enabled, and they tell you to actually try it, and report any error messages you have if it doesn't work.If it doesn't work, I'd suggest that you try running<?php phpinfo() ?> and show them the contents in addition to reporting any error messages. My PHP is running at version 5 and there are not any errors. I have since move to a PHP script to parse the XML to My Sql and this works very nice. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.