Subject: Re: xsl write file From: matt rainer <mattrainer@xxxxxxxxx> Date: Sat, 2 Dec 2000 17:15:03 -0500 (EST) |
Hi Mike, I am actually using Apache cocoon which is on the server, and it does the transformation for me on the server side and feeds HTML to the browser. Instead of feeding it to the browser I want to write a PHP file on the server so that I can use redirection to process the PHP file. I have tried Xalan, to write a simple xml file to the server but it doesn't write anything to the server: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="xalan-split.xsl"?> <?cocoon-process type="xslt"?> <FORM> <TITLE>FORM1</TITLE> <HEADING>TEST FORM</HEADING> <TEXT>This is some text</TEXT> </FORM> Here is my XSL: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="org.apache.xalan.xslt.extensions.redirect" extension-element-prefixes="xalan" version="1.0"> <xsl:template match="FORM"> <form> <xsl:copy-of select="TITLE"/> <xsl:copy-of select="HEADING"/> <xsl:apply-templates select="TEXT"/> </form> </xsl:template> <xsl:template match="TEXT"> <xsl:variable name="file" select="hello.xml"/> <hello href="$file"/> <xalan:write select="$file"> <xsl:copy-of select="."/> </xalan:write> </xsl:template> </xsl:stylesheet> Even if I try it without cocoon it should work but doesn't. Can you shed any light on this? I have checked the write permissions on the directory, and it is ok. ------Original Message------ From: Mike Brown <mike@xxxxxxxx> To: xsl-list@xxxxxxxxxxxxxxxx Sent: December 2, 2000 8:00:16 PM GMT Subject: Re: xsl write file matt rainer wrote: > I have an XML and XSL which can output some PHP on the browser. I need this > to be writen to a file with a php extention. > > Please can you tell me if there is any way of creating this file on the > server and putting the the PHP content in it, using XSL? Most XSL processors serialize the result tree to the standard output by default, so you could capture and/or redirect stdout and put the output where you want it. Some XSL processors offer additional output options from within the XSLT code, using extension functions & elements. Check the docs for your processor. An example command line for Unix and DOS shells: saxon in.xml in.xsl > out.php This of course is entirely not how it's done with MSXML, which it sounds like is what you're using. PHP relies on the web server to feed the HTML+PHP file to the PHP interpreter, and then the server delivers whatever comes out of the interpreter. If what you are trying to do is make it so that one HTTP request results in a chain of events like: requested XML doc -> XSLT processor -> PHP processor -> output to browser, I'm not sure it's easily possible. It would be interesting to hear how you did it, if that's what you're doing. It's definitely not going to be a simple task if the XSLT processor is in the browser (as MSXML is) rather than on the server. - Mike ____________________________________________________________________ Mike J. Brown, software engineer at My XML/XSL resources: webb.net in Denver, Colorado, USA http://skew.org/xml/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list ----------------------------------------------- FREE! The World's Best Email Address @email.com Reserve your name now at http://www.email.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: xsl write file, Mike Brown | Thread | Re: xsl write file, David Carlisle |
Re: xsl write file, Mike Brown | Date | Re: xsl write file, David Carlisle |
Month |