[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.
]

Hello,

while using Google I found the following message:
   http://mail.gnome.org/archives/xslt/2003-February/msg00038.html

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
    section:

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

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

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

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

Sincerely
Christian





-- 
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]