cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J.Pietschmann" <j3322...@yahoo.de>
Subject Re: including scripting in output files
Date Mon, 04 Nov 2002 20:59:21 GMT
Steven Noels wrote:
> Template is there, PI-template there, but apparently the HTMLSerializer 
> happily chops the second question mark away from the output:
> 
>     <?php phpinfo() >
>                    ^^
> 
> Let's complain loudly :-)

That's the way PIs are serialized in HTML. Take the XML serializer...oh
well, need special tinkering for <br> and such...
Maybe the serializer can be tricked with
  <?php phpinfo() ??>
but I think it will output
  <?php phpinfo() ? >
Last resort: Run something like
  <xsl:template match="*">
    <xsl:text>&lt;</xsl:text>
    <xsl:value-of select="name()">
    <xsl:for-each select="@*">
      <xsl:text> </xsl:text>
      <xsl:value-of select="name()">
      <xsl:text>=</xsl:text>
      <xsl:value-of select=".">
    </xsl:for-each>
    <xsl:text>&gt;</xsl:text>
    <xsl:apply-templates select="node()"/>
    <xsl:text>&lt;/</xsl:text>
    <xsl:value-of select="name()">
    <xsl:text>&gt;</xsl:text>
  </xsl:template>
  <xsl:template match="processing-instruction()">
    <xsl:text>&lt;?</xsl:text>
    <xsl:value-of select=".">
    <xsl:text>?&gt;</xsl:text>
  </xsl:template>
and use the text serializer (be carful with encodings, UTF-8 for best
results).
Actually PHP source *is* text, stuff like
  <div class=<?php echo "$class"?>>
is *not valid HTML or XML or whatever.

J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message