Dynamic XML + XSLT With Output As A Downloadable CSV File.
I Have a piece of dynamically generated XML, that i need to transform into a downloadable CSV file. There are several restrictions though. First of all i don't want to store output file on the server, and i don't have the XML file (it is being generated, but i do have the XSL file to transform the XML into CSV on my server). Any ideas on how i might do that?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Create Downloadable Xml File
I need to make a downloadable xml google sitemap based off of mysql data. What fuctions would I use. I assume I would be using fopen to write it, but how do I make it downloadable. I don't want there to be a copy of it on the server (permissions wouldn't allow it anyway), I just want people to hit a button, generate the file, and download it.
Downloadable CSV
Hi Guy, any idea how to create Downloadable CSV (comma-separated-value)
PDF Downloadable Form
I have been looking for a script for my site that will allow someone to download a form I have via PDF.
Output Variable Contents In Htm File From Php File
I have a PHP file. No MYSQL database. I'd like to have it open an .htm file and output the results in the php file to the .htm template. So, for example say there is a bunch of variables called: $make $model $year I want to open a .htm file and output the contents of $make, $model & $year in the htm format using variables in the htm itself. ie. {make} {model} {year} and it would import the contents of each into the corresponding tag.
Getting A File Via Http Or Evaluating A Php File And Getting Its Output
I need to somehow merge two separate web programs written in php together (from the user's perspective). This solution won't be perminant, I just need something done quickly. I was thinking of two different approches. One would be to download a processed version (modified so it will create validating html with the page it's being embeded in) of one of the programs with the other, then just use print to embed it in the page. I couldn't find out how to get a file via http here (http://us2.php.net/manual/en/index.php). Sorry if I missed this in the docs. The other would be to process the other program and get it's command line output, and print that. If there's a better way to this, I'd be glad to hear it :) Also, I've never written any php before; so sorry if I missed something obvious to someone who has.
XSLT
I'm writing a script for mobile content delivery. It has to be adoptive to the capability of a user-agent. My php script echo a document formatted in xhtml. In trying to convert it to WML, I am learning to use php's XSL functionality. Am I doing it right?
Help With XSLT And PHP
I was reading another post about how to get the declarations to show when embedding PHP in an XML file. If you visit the following URL <snip> you will notice that everything is great (look at the source) but the XSLT document just doesn't seem to be working...help? By the way, it works without the PHP...
How To Output A File As An Image File?
I wrote a web counter in php that displays text and images. What I am now trying to do is to convert the output of this php script in an image. Why? Because certain blogs like MSN Spaces do not accept that you embed scripts. I believe I should look into the imagecreatefrom functions for a solution, but I find very little examples of how to use it, expecially imagecreatefromgd2 and the likes. Ideally I would need a function that allows me to input a URL (like my php script) and that ouputs an image. Perhpas someone can help me with this?
Can I Use PHP To Output A XML File?
I have made a flash file that parses an XML file to get its content. I've tested it with a static XML and it works great. Let's call that XML "xml1". I have made a MYSQL db and the accompanying PHP files to dynamically add information to the database. This works great. I tried to use PHP to output an XML file to replace the static one, thus completing the circle and allowing the client to enter data into the db and see it in flash. Let's call this one "xml2". The flash file won't accept the data from "xml2". I assume it's in some sort of doctype issue. By the way, I thought it might be the fact that the extension of "xml2" is .php instead of .xml, but that doesn't matter. "xml1" was successfully tested with a .php extension. When I view "xml2" in a browser, it looks like it's being treated like html instead of XML, but when I view the source, it looks exactly like the code from "xml1". What is the difference? Code:
Php And XSLT Templating
Recently I read a thread about using templates ( PEAR's ITX template system in this context ). But the author ( I think it was Ulf Wendel ) also mentioned that using template system soon becomes obsolete. He mentioned to use php + XML / XSLT instead ! Anyone know of any tutorials or source files that demonstrates this, or is it still too early for this ? cheers
Xslt Transformation With Php
I use the xslt functions provided by php. I am running in my computer the package xampp(www.apachefriends.org) which includes php/apache/mysql .. In this package the php includes the sablotron extension responsible for the xslt functions. The problem i have is that the obtained transformation is not the waited one. I try to proccess the same XML file with XSL file with a program called XMLspy and i obtained the desire and waited results. The transformation is made in the next way:
Xslt Xlt Transform
I am working on a Solaris box running 2.8. I needed a way to get merge the XSLl with the XML. I found the PHP would do the trick for me. I loaded libxslt-1.1.8 and libxml2-2.6.9, bult them and installed. Then loaded PHP 5. Same thing, built it and installed it. I created this simple script; <?php $xh = xslt_create(); $myResult = xslt_process( $xh, 'test.xml', 'style.xsl' ); xslt_free($xh);?> I get the following error; Content-type: text/html X-Powered-By: PHP/5.0.0 <br /> <b>Fatal error</b>: Call to undefined function xslt_create() in <b>
About PHP & XSLT 2.0 Support
I was trying to write some XSLT transformation from XML to WML and XHTML. I want to transform attached news.xml into 2 different HTML files containing value of full tag. Then I want to Hyperlink them in another HTML page based on their story id attribute ( ex. n1.html, n2.html ). So far I know I have to use XSLT 2.0 for such operation. I donno if anyone know any trick to do that using XSLT 1.0. In Both case I want to know - 1. Is it possible to do it using XSLT 1.0 & PHP 4.4 with any XSLT extensions ? If yes pls provide some sample code snippet & XSLT extensions I need to use it 2. If not then Is there any extension ( Other than Sablotron, as in support only XSLT 1.0 ) using which I can perform the previous transformation ?
Popen() Output To A File?
I have a linux binary that I run from a webpage which produces a lot of output and I would like to send that to a file, but nothing seems to work here is an example.. It does however send it all to the httpd "error_log" file Code: <? popen("/home/mybinaryfile > output.file", "w"); ?>
Print Output From Log File
I my php script I call a perl script that perl script will create a log file From the php script I want to read the log file and write the output to the browser. This operation has to carried out for till the perl script completes the process. This can be identifed by [Process Completed] in the log file. My problem is when I read the first line and print to the browser it was going fine. Second time when the loop continues it print the sample content again and again. This has to be avoided and it has the print the new logs only. Or clear the previous output and print it fresh again. Ex. First time Processing 1... Second time Processing 1... Processing 1... Processing 2... Actually in the second time it should print only Processing 1... Processing 2... My Code: -------- while ($line = fgets($fp)) { trim($line); if ($line != "Completed") { print $line ."<BR>"; } else { exit(); } } fclose($fp);
Sending Output To A File
Lets say I got something simple like: <?php echo "yo"; echo "word"; ?> I want all those echos to write to a file instead of printing to the screen without changing to a different function. Sort of like how in Unix you can do ./my_prog < file1 to output to a file. In this case I want it all to be done in code. For example, something like: <?php output_to_file_instead_of_screen(); echo "yo"; echo "word"; output_to_screen(); ?>
How To Output From File Into Table?
I have this bit of code that opens a file, reads it line by line, and prints the filename into an image on screen, so i get a big list of images on the page. However I want it to output into a table so I can have 2 photos side by side as it goes through, is there any way of manipulating the code to output one line into one cell and the next line into the next cell then back to the first cell again??? <? $data = file('gallery/captions'); foreach ($data as $line) { list ($q, $a) = explode('|' , trim($line) ); echo "<img src='gallery/images/$q' height=100><br>"; echo "$a<br>"; } ?>
PHP5.1.4, DOM Using CDATA In XSLT
I've run into very disturbing problem, I must use html tags inside one of my XML node so I wrote: $cdataHelp = $DomDocument->createCDATASection($value); when I dump it as XML header('Content-Type: text/xml; charset=UTF-8"'); echo $DomDocument->saveXML(); CDATA is displayed (and its HTML tags) properly, when applying a stylesheet: $xslt = new xsltProcessor(); $xslt->importStyleSheet(DomDocument::load($styleSheetName )); echo $xslt->transformToXML($DomDocument); with XSL stylesheet with: <xsl:value-of select="help" disable-output-escaping="yes"/> all < and become < and > and I can see them in my browser as a part of text. it looks like DOM API supports adding CDATA sections but XSLTProcessor doesn't support it Is there some work-around for using CDATA + XSLT (PHP5)?
Lack Of XSLT Support In Php 5.2.1
i got a problem with my hosting provider and the system admin seems not to be a top class specialist... I'm not one myself though. The problem is related to XSLT support in php. phpinfo() returns: PHP Version 5.2.1 './configure' '--enable-pic' '--with-apxs=/usr/local/apache/bin/apxs' '--with-libdir=lib64' '--prefix=/usr/local' '--with-xml' '--enable-bcmath' '--enable-calendar' '--with-curl' '--with-dom' '--with-dom-xslt' '--with-dom-exslt' '--enable-exif' '--enable-ftp' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr' '--with-xpm-dir=/usr/X11R6' '--with-gettext' '--with-iconv' '--with-imap=/usr/local/imap-2004g' '--enable-mbstring' '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-mcrypt' '--with-mhash' '--enable-magic-quotes' '--with-mysqli' '--with-mysql=/usr' '--with-openssl' '--enable-discard-path' '--with-pear' '--enable-xslt' '--with-xslt-sablot' '--enable-sockets' '--enable-track-vars' '--with-ttf' '--with-freetype-dir=/usr' '--enable-gd-native-ttf' '--with-xmlrpc' '--with-zlib' Now, the interesting parts are: '--with-dom-xslt' '--enable-xslt' '--with-xslt-sablot' Those would suggest that php was in fact compiled with support for xslt in 3 different ways. In fact, non of those are acctualy avaiable in php. Using any of them produces fatel error. DomDocument seems to be there, but domxlm_xslt* functions are not. xslt_create is not avaiable nor is XSLTProcessor class.
Parsing UTF-8 String With XSLT
the majority of my sites use PHP MYSQL and XSLT for dynamic pages and all of it works ok for English characters. The problem begins when I try to use Romanian or Russian characters while creating the XML string. What I used to do is: 1) Query the MYSQL database that is UTF-8 (the conection is also set by a query to UTF-8) 2) Create a XML string in PHP using the query results 3) Transform the XML string using a XSLT parser As I said it all works ok with the English data but when I try using Russian instead of letters I get question signs. If I try to echo the Russian text when creating the XML data it is displayed correctly, so the problem is in the XML string that is somehow not UTF-8 encoded or what?
XSLT Processing Instruction To Use PHP
I've got me an XSL tranformation stylesheet for my XML file. In the XSL file I now wish to use PHP to do some scripting. So I thought I'll use the PIs like this: <xsl:processing-instruction name="php"> echo $hello; </xsl:processing-instruction> But this just gets ignored. No error, just not processed. Do I need to enable something (in PHP, Apache) to use these PIs? This is on an Apache/2.0.49 (Win32) PHP/4.3.6 Server.
Using Browser XSLT Transformations
I'm not sure if this is the right group for this question. It seems to span a few topics. I have a PHP page that generates XML output. I want to push this output through a stylesheet transformation and display this to the user. I know the transformation is sound because if I save the output as a .xml file it renders fine. However, the PHP page is displayed as raw text without even line breaks. I suspect that because the extension for the page is .php the browser does not know to treat it as XML and apply the stylesheet. Is it possible to force the browser to do this? Once I have this working, I would then like to embed the XML into a larger page generated by PHP. Will the browser be able to only stylesheet-process the XML portion of the page and leave the rest literal? Any general suggestions on how to embed stylesheet-transformed XML into a web page? I know I can use the XML XSLT routines to hand-crank the transformation, but leaving the XML as it is and getting the browser to transform seems a lot cleaner.
Storing Form Output In XML File.
I have a form. I want two actions in it. first i want to save all the informations entered in form into a XML file. second How to save Mysql query output to a XML file. Please give me some example (with code).
Running Script Before Output To File
I've got an HTML emailer system where the user creates an HTML file with their input from a form. I've had no problem with this part, neither with the email sending and display HTML. However, before the contents of the HTML email (the HTML file the user creates) gets applied as the message body and emailed via PHP, I would like the file to be passed through PHP and any scripts run that happen to be on the template. My actual portion of email code is here (where the file is read into a variable and the mail is sent): $emailHeaders = "From: info@domain.com" . "X-Mailer: PHP/" . phpversion() . "" . "MIME-Version: 1.0" . "Content-Type: text/html; charset=utf-8" . "Content-Transfer-Encoding: 8bit"; $emailMessage = file_get_contents(path/filetosend.php); $emailSubject = "Email Subject"; $emailRecipient = recipient@domain.com; mail($emailRecipient, $emailSubject, $emailMessage, $emailHeaders); How do I make any PHP scripts that are in the "filetosend.php" run before the output is stored into $emailMessage and mailed off?
Including File And Output To Browser
I am not sure I understand the rules as to what exactly gets output to a browser and when. If I include a text only file or an html file, these will show up in the browser regardless of where in the script they are included.
When Output File Shows Only Text...
In an attempt to try out some things with php, I have run into a new snag. The output file is pure text. Basically it's a simple photo gallery using <ul> links to show various thumbnails. In turn, the thumbnails show a bigger image. All on the same page. My only possible thinking is that it has something to do with the array notation. $image =array ( ); $image[101]="name.jpg"; Is it correct to say $image = array(999);? As to define 999 items? as in javascript?
Saving Output As An .html File
I have a script which takes about 20 or so fields as input and creates a big table out of all those. I want to log what happens and I was wondering if there's some way I can save each table as an .html file in my directory.
Output Xml File From Mysql Record
how to get the record from databse directly..but now my application require me to output my record as xml output....so I really need help on it.../some guide ...this is what's my xml gonna be.. Code:
Formatting Of A .txt File Output From A Web Form.
how I can force new lines to happen in a .txt file that stores the results of a webform that a user inputs? As it stands I've tried using and /n tags but they just print to the file and all the text runs on. Also, every time data is appended to the .txt file it appears on the same line.
Write Broswer Output To New File
I have a file (say, output.php) which produces information which is output to a browser at present. That's good. But I need the exact browser ouptut to be turned into a text file (say, output.txt) which will be automatically saved somewhere on my disk, whenever output.php is run. How can I make this happen?
Sablotron Xslt Question. Is There A Better Way To Code This?
Here is my code that works fine. I am wondering if there is a better way to do this. In my xslt transformation it seems I HAVE to reference an XML file even though I am just processing a stylesheet. So as you can see in my code I reference a valid xml file named continents.xml- even though the xsl styleheet does not NEED it! Is there different syntax for doing this so I don't need the reference to continents.xml? ======================= default.php: ======================= $xh = xslt_create(); if($browsertype == "WML") { Header("Content-Type:text/vnd.wap.wml"); $result = xslt_process($xh, $currentpath . "continents.xml", $currentpath . "default_wml.xsl"); } else if($browsertype == "HTML") { $result = xslt_process($xh, $currentpath . "continents.xml", $currentpath . "default_html.xsl", NULL, array(), $params); } if ($result) { print $result; } else { print "xslt error occured"; } xslt_free($xh); ======================== search_html.xsl file: ======================== <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:include href="inc_html.xsl"/> <xsl:output method="html"/> <xsl:template match="/"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <xsl:call-template name="header"/> </head> <body> <xsl:call-template name="topbody"/> <xsl:call-template name="contenttable"/> <xsl:call-template name="footer"/> </body> </html> </xsl:template> <xsl:template name="content"> <table width="90%" cellpadding="0" cellspacing="0" border="0" class="content"> <tr> <td>
Copy Large XML Output To A Local File
I have a URL that when called generate a very heavy XML Feed like: www.domain.com/generateXML.php?id=products when i call this URL in the browser i can see a very long XML file generated containing different information..i want to copy this all output to a local file on my server so that i can use that file's info for different tasks on my site...PHP Code:
Load The HTML Output Of A File Into A Variable?
How can i load the html output of a file into a variable.. Kind of like include()ing or require()ing a file.. but not echoing the content.. but saving it to a variable.. Can it be done? I dont want to use fgets because they are PHP files.. and i want to get the HTML as if a user opened with a browser..
BUG Xslt Test With A Minus Char In Php & Domxml
When I try to do : URI = <xsl:value-of select="//@URI"/><br/> <xsl:if test = "//@URI != Ƌ-42922'">not equal</xsl:if><br/> <xsl:if test = "//@URI = Ƌ-42922'">equal</xsl:if><br/> The result is : URI = 5-42922<br/> not equal<br/> equal<br/> If I remove the - (minus) of my test, it's works fine! ....
Read From A Text File, Output To Browser In Japanese
I am trying to store data in a text file and output it to the browser using PHP. All very easy - if I was using English! the problem is, I want to use Japanese and I'm finding it a tad difficult to get PHP to understand. I have two files, a text file containing data to display and a php file with a script to display the data. I can get the contents of a text file displayed in English, no problemo, but in Japanese, it's another story... All the correct settings are enabled in the php.ini file for Japanese language support (mb_string, input_encoding, output_encoding settings etc..etc..) even if I save the text file, to be read from, in Shift_JIS encoding - I still can't get it to display normally! here's the script I'm using to read the text file : <? $filename="test.txt"; $fp = fopen($filename,'r'); while($line=fgets($fp)) { //output text file line print $line."<br>"; } fclose($fp); ?>
Dynamic File Generation
I have a script that creates a HTML for every row in a DB query result. I had this working normally but for some reason I am now having strange problems. Firstly, there are 2 files: a generator.php file that runs a loop which in turn calls another PHP file and saves the output of that as HTML file with a special naming format. the second file is the resultscache.php file. This file could be called on its own for any set of results but I need to create HTML from it as a form of caching system. PHP Code:
Parsing A Dynamic RSS File
I'm a bit new to PHP, so please bare with me. I've been studying it for a couple of months now and really like it. On the main page of my website, I would like to include a small box that lists the title of the latest blog entry (as well as making that a link to the entry) to my WordPress blog. I was thinking about parsing the RSS for this, but I'm not sure how to parse a dynamic RSS feed. Or is there some simpler way of doing it and I'm trying to overprogram?
Extra Newlines In Output Text Added By PHP File Include
I have a simple PHP script that outputs a string requested by an Ajax page. XMLHttpRequestObject.responseText as received from the PHP script begins with 2 extra newline characters ( MyString): <?php require_once('DB.php'); require_once('../myDir/myFile.php'); ....... echo('MyString'); ?> myFile <?php $var1 = 1; $var2 = 2; $var3 = 3; ?> If I manually write the contents of myFile.php into the script, there are no extra newlines in responseText. Am I missing something?
Send Dynamic .RTF File As Attachment?
I am having problems determining how to dynamically create a Rich Text File (.rtf) and send it as an attachment. The code that I came up with works pretty well except that when the attachment is opened in MS Word, it displays all the code for the .RTF formatting instead of displaying the appropriate text cleanly. NOTE: the $message variable below is filled with the code to create a very simple RTF that reads "test message" - I created the file in MS Word and saved it as an RTF, then I opened it in a text editor and copied and pasted the code.
Saving/downloading A Dynamic File
Is there a way of making a PHP script go to a URL, like www.somedomain.com/file?id=2, and saving the dynamic file that is created? I want to run this script in crontab, so it downloads the file every hour. I have tried using wget, but that doesn't seem to save the dynamic file created, it just saves the blank HTML page "file?id=2".
Member Area With Dynamic File List
I have an Apache 1.3.31 with PHP 4.4.1 available and want to create some kind of "member area" with a per-user or per-group listing of files that can be downloaded. How would I do this? At present I just protect the individual files using .htaccess and .htpasswd files and give out direct URLs to the files together with username/password. What I'd like is some login functionality where people can log in using their username/password and then find a list of files they can download together with additional information individually tailored for that user.
Dynamic File Download With *long* Response Time
I've got a Java servlet that delivers large database resultsets transformed to Excel with the HSSF library. In some cases it takes more than 15 minutes before transformation is done and content can be delivered to the browser. I want to show the "Save As" dialog as early as possible so the user knows he's not lost and forgotten. I already tried to send the response headers immediately after receiving the request including content disposition and filename. Even though the browser receives those headers it just won't trigger the "Save As" dialog. This applies to both MS IE and Mozilla...
|