[thelist] XSL: Finding apostrophes

Jason Bauer jbauer at mtu.edu
Thu Jan 24 13:55:00 CST 2002


Anyone know how to escape an apostrophe for passing to another page through
the URL?

I'm making an online directory using Oracle XSQL pages, translated with
XSL. I get a list of names from the table, and then the user can click on a
name to get more information. I'm having a real problem with names that
contain apostrophes (ex: O'Donald)

If I simply call my page with the name as normal, it gives me an SQL error
because there is a single apostrophe in my query. I've attempted to escape
the apostrophe in my XSL file, but it gives me a Literal Mismatch error
when I try to look for it using '

Here is the code I'm trying:

<xsl:template match="name">
         <a><xsl:attribute name="href">search.xsql?name=<xsl:value-of
select="substring- before(.,'&apos;')" />&apos;&apos;<xsl:value-of
select="substring-after(.,'&apos;')"    /></xsl:attribute><xsl:value-of
select="." /></a>
</xsl:template>

I've also tried making a variable that contains a '. Doing that, I don't
get an error, but the substring-before return nothing when I use the
variable instead of &apos;... Thanks for any help you can offer!



---
Jason Bauer
jbauer at mtu.edu
Michigan Tech Fund
Web Site Coordinator
http://www.mtf.mtu.edu/




More information about the thelist mailing list