Re: [xslt] handling of < in CDATA sections



Vincent Lefevre wrote:
On 2005-02-22 11:30:17 +0100, Roel Vanhout wrote:
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?

Well I want to create a php tag, and php tags just happen to look like processing instructions, so that's why I'd consider it cheating. But you're right, it depends on how you look at it :)


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

I'm using E:\cvs\gtkmm2\docs\tutorial>xsltproc -V Using libxml 20617CVS2313, libxslt 10112CVS991 and libexslt 810CVS991 xsltproc was compiled against libxml 20617, libxslt 10112 and libexslt 810 libxslt 10112 was compiled against libxml 20617 libexslt 810 was compiled against libxml 20617

and your test case below works ok for me too. However when I run it as part of my docbook toolchain, as described in the bug report to gtkmm that I referred to earlier (http://bugzilla.gnome.org/show_bug.cgi?id=168030), it doesn't work any more. Here's the output up to the point where the error is visible:

<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 1. Introduction</title><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"><link rel="start" href="index.php" title="Programming with gtkmm2"><link rel="up" href="index.php" title="Programming with gtkmm2"><link rel="prev" href="index.php" title="Programming with gtkmm2"><link rel="next" href="ch01s02.php" title="gtkmm"><?php
require_once('phpwebnotes/core/api.php');
pwn_head();
></head>


I think it has something to do with the fact that the output format is html; if I try to change the <root> element in your example to <html>, I get the following output:

C:\>xsltproc pitext.xsl pitest.xml
<html><?php
        $var = 0;
    ></html>

Notice that the ? is not there in this case! As you can see, I'm running on windows and using a slightly different version than you do, would you mind trying the <root> to <html> and see if you can reproduce it?

BTW, this is much cleaner than the solution based on escaping (proposed
by Daniel), IMHO. Disabling escaping is evil.

Well at this point I'm just trying to get a working solution, that's all :) Thanks anyway for guiding me on the way to Enlightenment ;)


Daniel's first solution won't solve your problem, as you'll get a
document that will be semantically the same after parsing.

That's right, it was the second solution that I was referring to.

Thanks.


cheers,

roel



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