output of "<" and ">" in stylesheet

D

David Carlisle

Assuming you mean an xslt stylesheet (rather than css or some other
system) it's XML so for < you can use &gt; and for > you can use either
&gt; or >

David
 
D

Diandian Zhang

David Carlisle said:
Assuming you mean an xslt stylesheet (rather than css or some other
system) it's XML so for < you can use &gt; and for > you can use either
&gt; or >

David

Hallo, David,

I am writing an xsl stylesheet. It seems that $lt; and $gt; don't work.
 
D

David Carlisle

Hallo, David,

I am writing an xsl stylesheet. It seems that $lt; and $gt; don't work.

You are allowed to give us some clues:

Do you mean:

The system generates an error (if so, what error message)
or
the system generates the wrong output (if so, what output did you get
and what output did you want).

The way to specify a < in XML is to to use &gt;. Of course it will also
be output that way as well in the html or xml output methods.

If you mean you want a literal < in the ouput then perhaps you are not
generating XML and so should use xsl:eek:utput method="text"

David
 
D

Diandian Zhang

David Carlisle said:
^^^^
&lt;

Hallo, David,

thank you for your reply. What I want to generate from a XML file, is
a text file as the following:
<'
some things
more things
...

And my stylesheet looks like this:
<xsl:stylesheet ...>
<xsl:eek:utput method="text"/>
<xsl:template match="/">
<xsl:text>&lt;'</xsl:text>
...
</xsl:template>
</xsl:stylesheet>

The output is &lt;' instead of <'. Have I done anything wrong here?
 
D

David Carlisle

The output is &lt;' instead of <'. Have I done anything wrong here?

Your stylesheet is fine but your system is clearly using XML not text
serialisation so is ignoring your xsl:eek:utput.

Usually this only happens if you output from XSLT to a DOM or other
kind of in memory structure rather than to a file and then get the final
output from the DOM (which doesn't know anything about xsl:eek:utput hints)

so it probably depends on what system you are using and how you are
calling it.

David
 
M

Malcolm Dew-Jones

Diandian Zhang ([email protected]) wrote:

: thank you for your reply. What I want to generate from a XML file, is
: a text file as the following:
: <'
: some things
: more things
: ...
: >'

: And my stylesheet looks like this:
: <xsl:stylesheet ...>
: <xsl:eek:utput method="text"/>
: <xsl:template match="/">
: <xsl:text>&lt;'</xsl:text>

did you try

<xsl:text disable-output-escaping='yes'>

: ...
: </xsl:template>
: </xsl:stylesheet>

: The output is &lt;' instead of <'. Have I done anything wrong here?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,246
Members
46,840
Latest member
BrendanG78

Latest Threads

Top