output of '<', '>'

output of '<', '>'

Post by paul » Sat, 09 Nov 2002 07:11:32



I tried to output left/right brackets as a result
(print out '<' and '>' )
but instead, got output like :

11)< or > for below input
<xsl:value-of select="'<'"/>
<xsl:value-of select="<"/>

22)parser said expression expected -><<- for below input
<xsl:text><</xsl:text>

please help to give right format.

thanks'

Paul

 
 
 

output of '<', '>'

Post by Scott M » Sat, 09 Nov 2002 12:22:02


Try &lt; instead of < and &gt; instead of  >.


Quote:> I tried to output left/right brackets as a result
> (print out '<' and '>' )
> but instead, got output like :

> 11)< or > for below input
> <xsl:value-of select="'<'"/>
> <xsl:value-of select="<"/>

> 22)parser said expression expected -><<- for below input
> <xsl:text><</xsl:text>

> please help to give right format.

> thanks'

> Paul


 
 
 

output of '<', '>'

Post by paul » Sat, 09 Nov 2002 13:04:40


Hi

thank you for yr comment, but it's kind of wired

I typed my question in < ; and > ; instead of <, >
but it all showed out in <, > format.

So I originally tried what you suggested, but not work
pls give other suggestion,

thanks
Paul

>-----Original Message-----
>Try < instead of < and > instead of  >.



>> I tried to output left/right brackets as a result
>> (print out '<' and '>' )
>> but instead, got output like :

>> 11)< or > for below input
>> <xsl:value-of select="'<'"/>
>> <xsl:value-of select="<"/>

>> 22)parser said expression expected -><<- for below input
>> <xsl:text><</xsl:text>

>> please help to give right format.

>> thanks'

>> Paul

>.

 
 
 

output of '<', '>'

Post by Oleg Tkachenk » Sat, 09 Nov 2002 19:02:37



> thank you for yr comment, but it's kind of wired

> I typed my question in &lt ; and &gt ; instead of <, >
> but it all showed out in <, > format.

> So I originally tried what you suggested, but not work
> pls give other suggestion,

Sorry, it's rather unclear what is you question, at least for me,
reformulate it please a little.

--
Oleg Tkachenko
eXperanto team
Multiconn Technologies, Israel

 
 
 

output of '<', '>'

Post by Paul » Sat, 09 Nov 2002 23:04:03


I tried to output left/right brackets as a result
(print out '<' and '>' )
but instead, got output like :

11)input:
<xsl:value-of select="'< ;'"/>
<xsl:value-of select="> ;"/>
   output
< ; or > ;

22)input:
<xsl:text>< ;</xsl:text>
   output:
parser said expression expected -><<- for below

please help to give right format.

(This time I put < and ; apart because if I don't do so,
the newsgroup automatically transfer < ; to '<' sign,
like below message make misunderstanding :( . )

Tks
Paul.

>-----Original Message-----

>> thank you for yr comment, but it's kind of wired

>> I typed my question in < ; and > ; instead of <, >
>> but it all showed out in <, > format.

>> So I originally tried what you suggested, but not work
>> pls give other suggestion,
>Sorry, it's rather unclear what is you question, at least
for me,
>reformulate it please a little.

>--
>Oleg Tkachenko
>eXperanto team
>Multiconn Technologies, Israel

>.

 
 
 

output of '<', '>'

Post by Stuart Celarie » Sun, 10 Nov 2002 00:52:44


Paul,

The <xsl:value-of> element's select attribute must be an expression, not a
text string [1]. The expression is an XPath expression that selects nodes
[2]. You might want to make more of an effort to learn XSLT, guessing at
syntax is a slow and frustrating method not guaranteed to succeed.

The < and > characters are special to XML [3], and XSLT is XML. If you want
to use < as a character, rather than as a XML markup delimiter, you need to
use the character entity reference &lt; or learn about CDATA sections in XML
[4].

To output a < character, use &lt; as content instead of trying to use it as
a select expression, as in

<xsl:output method="text"/>
<xsl:template match="/">
  &lt;
</xsl:tempate>

You can also use the <xsl:text> element to explicitly indicate that you are
generating text content in the result tree, as in <xsl:text>&lt;</xsl:text>.

A word to the wise: if you are trying to generate the < and > symbols to be
used as markup delimiters in the result of an XSLT transform, then you are
definitely heading in the wrong direction. For example,

<xsl:text>&lt;h1&gt;Heading&lt;/h1&gt;</xsl:text>

is unquestionably not what you want to do. And do not resort to
disable-output-escaping to try to make this work.

Cheers,
Stuart
--
Stuart Celarier, Fern Creek, www.ferncrk.com
Consultant on .NET, Win32, C#, C++, COM, XML, XSLT and more.

[1] http://www.w3.org/TR/xslt#value-of
[2] http://www.w3.org/TR/xslt#dt-expression
[3] http://www.w3.org/TR/REC-xml#syntax
[4] http://www.w3.org/TR/REC-xml#dt-cdsection

 
 
 

output of '<', '>'

Post by paul » Sun, 10 Nov 2002 05:43:31


Thanks Stuart very much for your valuable comment