Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Quoting confusion

Thread Tools

Quoting confusion

Derek Fountain
Posts: n/a
How do I get a three character string like


in my output? It thought using &lt;p&gt; should do it, but no. I get the
literal characters.

As a test I wrote this little bit of XSLT:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
<xslutput method="html"/>

<xsl:template match="/">
<xsl:text>&apos; &lt; &gt; &quot; &amp;</xsl:text>


When run I get:

>xsltproc test1.xsl test1.xml

' &lt; &gt; &quot; &amp;

The &apos; seems to convert to a ' correctly, but the others come out
literally. That's under Linux with libxml2, but I'm seeing the same issues
on Windows.

What have I done wrong?
Reply With Quote
Nicolas Stern
Posts: n/a
Hi Derek

I solved the problem this way:

- use output method="text"
- put your text in a cdata segment

Hope this helps - regards - Nicolas Stern

sample code for the xsl stylesheet:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlnssl="">
<xslutput method="text" />

<xsl:template match="/">
<h2> 1 < 2 </h2>


Reply With Quote
Derek Fountain
Posts: n/a
> I solved the problem this way:
> - use output method="text"

That appears to be the key. The CDATA stuff you also implemented wasn't
necessary, either for my project, or my little test script.

Now I need to understand why the output method changes the way these things
behave. I'll start a new thread for that.

Thanks for your help!
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
cgi / javascrip / perl / innerHTML quoting confusion seven.reeds Javascript 2 06-21-2006 05:16 AM
What are all these nonesence sites quoting mine but with no content? xyZed HTML 8 04-05-2006 04:52 PM
Quoting literals properly yoni XML 12 02-18-2006 10:42 PM
Quoting original messages in replies John Coxon Firefox 14 04-24-2004 06:18 PM
Outlook Express quoting NetNews Computer Support 4 11-16-2003 08:10 AM