473,320 Members | 1,991 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Quoting confusion

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"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output 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?
Jul 20 '05 #1
2 1627
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" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" />

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

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

</xsl:stylesheet>
Jul 20 '05 #2
> 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!
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: David M. Wilson | last post by:
Hello fellow users! I've been using Python in a couple of different environments for a few years now. I have quite often found that I have needed to deal with filenames which may contain...
2
by: snacktime | last post by:
I'm used to using the perl DBI and not very familiar with the python DB-API. I am using PyGreSQL. My question is what is the standard way to quote strings in sql queries? I didn't see any...
6
by: Allan | last post by:
I need help writing a program. I need to convert temps. from fahernheit to celsius. This is what I have. Can someone help? // This program is for converting temperatures recorded in Fahrenheit to...
22
by: Jane Withnolastname | last post by:
I have been using the charset windows-1252 for a while, but it was pointed out to someone else in this group recently that it's a Microsoft creation (I'm sure I'm getting my facts wrong or skewed)...
383
by: John Bailo | last post by:
The war of the OSes was won a long time ago. Unix has always been, and will continue to be, the Server OS in the form of Linux. Microsoft struggled mightily to win that battle -- creating a...
27
by: Ron Adam | last post by:
Hi, I found the following to be a useful way to access arguments after they are passed to a function that collects them with **kwds. class namespace(dict): def __getattr__(self, name): return...
4
by: Tim Robinson | last post by:
Hi, I generally consider myself competent with the complexities of quoting but I can't figure out postgres at all. I've read the manual and it looks very straightforward but that doesn't accord...
10
by: Michael Hoffman | last post by:
Does anyone have a script to convert more conventional USENET quoting style like this: John wrote: > Jacob Jingleheimer Schmidt <jjs@example.net> wrote in message-id <gratuitous-detail> on 29...
2
by: seven.reeds | last post by:
Hi, I am not a js expert by any stretch and this might be a perl question more than js but I have to start somewhere so fingers crossed... Ok, I am doing some ajax and have this '<input...
7
by: Steven W. Orr | last post by:
Python has a number of "quoting" 'options' to help """with times when""" one way may be more convenient than another. In the world of shell scripting, I use a technique that I call minimal...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.