This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: How to use caracter " in a String


Tom P:
><xsl:value select='I want to say "Hello"'/>

This won't work

><xsl:value-of select="I want to say &quot;Hello&quot;"/>

Nor will this.

><xsl:value-of select " 'I want to say &quot;Hello&quot;' "/>

This will.

(I know you know really Tom, but for everyone else...)

The bit between the quotes is a node test, so when you say:

<xsl:value-of select="worldcup"/>

You are saying 'give me the content of the node <worldcup>', whatever
that may be.  If you want the string 'worldcup' in your output [as part
of a select statement] then you need to enclose it in quotes to identify
it as a string:

<xsl:value-of select="'worldcup'"/>
                      ^        ^
This tells the processor its a string and not the name of a node.  If
you then want it to be wrapped in quotes in your output, you need to
insert some escaped quotes around it:

<xsl:value-of select="'&quot;worldcup&quot;'"/>

and that will give you "worldcup"

cheers
andrew


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.350 / Virus Database: 196 - Release Date: 17/04/2002
 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]