[xslt] Re: <?php ... ?> and <xsl:output method="html">

[ Please note, that I'm NOT a list member. So for any possible
   answer, please send a copy back to me.


while using Google I found the following message:

Because I have a working solution, I want to share it now:

To embed PHP code in HTML generated from XML using XSLT (xsltproc),
I do this:

  - On the XML side I use a XML tag reserved for this task
    (for instance, here I use "PHP" for this). In this tag the
    markup containing PHP "processing instructions" (which in
    reality are no valid PM's) ist quoted through a CDATA

      <PHP><![CDATA[<input type="text" name="subject" value="<?php echo $_GET['subject']; ?>">

  - Inside XSLT I have defined a special template for this PHP tag:

      <xsl:template match="PHP">
        <xsl:value-of disable-output-escaping="yes" select="." />

Thats all - the result is valid and working PHP-HTML...


Christian Schmidt-Guetter
Email: chr@abelard.de
WWW:   http://www.schmidt-guetter.de/freiberuf/index.html
Tel.:  034297 / 86636

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]