[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Putting PHP Code in XSLT?

Subject: Re: Putting PHP Code in XSLT?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 21 Sep 2007 11:44:37 +0100
Re: Putting PHP Code in XSLT?
>        <xsl:processing-instruction name="php">echo "Hello!";   
> ?</xsl:processing-instruction>
> 
> The source code of the section above is there, but it is not working. 

I'm not sure what you mean by not working, It shoudl generate a php
instruction. It will not execute it, you need to put the file on a php
server for that to happen, just as if you generate C code with XSLT,
XSLt will generate it but it won't compile or run it, you have to do
that in a following process.

> When I take the ? off, the product becomes <?php echo "Hello!"; > which 
> is not in HTML format.

You have that backwards. HTML processing instructions just have a ? at
the beginning, although of course you can make the content end with a ?
if you wish. In XML the syntax is a bit different and the processing
instruction is terminated with ?>
so 
<xsl:processing-instruxtion name="zzz">kkkkk</xsl:processing-instruction>

witll generate
<?zzz kkkkk>
if XSLT is generating HTML and
<?zzz kkkkk?>
if it is generating XML.



> The other thing is, why don't we need to do this with Javascript?

If you wanted to put javascript in a processing instruction then you
would need to do that. If you want to put in an element you could do
the same thing, but change xsl:processing-instruction name="php" to
xsl:element name="script" for example. 

XSLT just views php or javascript as text there are no special rules for
either.

David



________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.