You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by Sean Treadway <se...@superchannel.org> on 2003/10/26 20:52:01 UTC

Reasoning behind <% or
Hi all,

I've recently been using a successful blend of XML/XSLT and PHP.  When I
perform my transformation from XML to HTML and wish to embed PHP, I can
use the <xsl:processing-instruction
name="php">code;</xsl:processing-instruction> element which will output
the following markup: <?php code;?>.  I wish to do the same with PSP,
but XML has a different meaning for % and AFAIK, XSLT only outputs
<?processing-instruction-name ?> blocks.

The fix looks simple, modifying psp_parser.l to open and close its
python blocks with variations of both <% and <?psp.

My proposal is to maintain all existing behavior, adding the following
alternatives:

Code block:	<% %>		<?psp ?>
Expression:	<%= %>	<?psp-echo ?>
Directive:	<%@ %>	<?psp-control ?> 
Comment:	<%-- --%>	<?psp-comment ?>

The biggest win of changing to the <?* syntax is that if properly used
(read avoid the expression block), our PSP files can validate as XML. 

The biggest drawback is that you have to type a bit more, but in most
cases this will be taken advantage of in XSLT which is very verbose.

What are your opinions on this?  If we agree on that this, I'll be happy
to make a patch.

-Sean