Re: [xslt] handling of < in CDATA sections
- From: Vincent Lefevre <vincent+gnome vinc17 org>
- To: xslt gnome org
- Subject: Re: [xslt] handling of < in CDATA sections
- Date: Tue, 22 Feb 2005 12:11:32 +0100
On 2005-02-22 11:30:17 +0100, Roel Vanhout wrote:
> Vincent Lefevre wrote:
> >The cleanest way in your case is to use xsl:processing-instruction to
> >create a PI.
>
> Although it does seem like cheating, this could indeed work.
This is not cheating, this is exactly what you want to do: create
a processing-instruction, right?
> <xsl:processing-instruction name="php">
> $var = 0;
> </xsl:processing-instruction>
> that should produce
> <?php
> $var = 0;
> ?>
>
> Unfortunately it seems that xsltproc makes that
> <?php
> $var = 0;
> >
> (notice the missing ? in the close tag of the PI).
Then this is a bug in xsltproc. But there's no problem with
Using libxml 20616, libxslt 10112 and libexslt 810
xsltproc was compiled against libxml 20616, libxslt 10112 and libexslt 810
libxslt 10112 was compiled against libxml 20616
libexslt 810 was compiled against libxml 20616
ay:~> cat test.xsl
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<root>
<xsl:processing-instruction name="php">
$var = 0;
</xsl:processing-instruction>
</root>
</xsl:template>
</xsl:stylesheet>
ay:~> xsltproc test.xsl test.xsl
<?xml version="1.0"?>
<root><?php
$var = 0;
?></root>
BTW, this is much cleaner than the solution based on escaping (proposed
by Daniel), IMHO. Disabling escaping is evil.
Daniel's first solution won't solve your problem, as you'll get a
document that will be semantically the same after parsing.
--
Vincent Lefèvre <vincent vinc17 org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]