Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Quoting confusion

Reply
Thread Tools

Quoting confusion

 
 
Derek Fountain
Guest
Posts: n/a
 
      08-13-2003
How do I get a three character string like

<p>

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"
xmlnssl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="html"/>

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

</xsl:stylesheet>
---

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
Guest
Posts: n/a
 
      08-13-2003
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="http://www.w3.org/1999/XSL/Transform">
<xslutput method="text" />

<xsl:template match="/">
<![CDATA[
<html>
<body>
<h1>Test</h1>
<h2> 1 < 2 </h2>
</body>
</html>
]]>

</xsl:template>
------------------------------------------

</xsl:stylesheet>
 
Reply With Quote
 
 
 
 
Derek Fountain
Guest
Posts: n/a
 
      08-13-2003
> 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
 
 
 
Reply

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



Advertisments