Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSL Escape Character for Apostrophe

Status
Not open for further replies.

MaKSiNG

Technical User
Dec 4, 2003
19
Hi All,

I am attempting to test for a string in the value of one of my XML elements. But this string in the XML is enclosed by apostrophes.

My XSL line looks like:
Code:
<xsl:if test="metadata/categories!='Life and Work Events'">
...
</xsl:if>

Now this works for a string which is not enclosed in the apostrophes.

This would be the logical solution but does not obviously work:
Code:
<xsl:if test="metadata/categories!=''Life and Work Events''">
...
</xsl:if>

I am thinking I need an escape character before the second apostrophe but might be barking up the wrong tree completely, besides I do not know what the escape character in XSL is. Is there a better solution?


Thx,
MaKS
 
have you tried:

Code:
<xsl:if test='metadata/categories!="'Life and Work Events'"'>
?
 
<Different user than original>
I actually tried what you said simon last night someone , alternating between the " and ' , the XML parser actually came back at me saying it was not well-formed.

Karl Blessing
PHP/MySQL Developer
 
Hi,

Thanks for the suggestion but I get the same XML not well formed error.
I didn't think the quotes could be interchangable quite as freely as that [smile]

Any other ideas?

Thx,
MaKS
 
Have you tried the XML predefined entity for the apostrophe?

[ignore]&apos;[/ignore]

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top