[xsl] Processing Entity ' question

Subject: [xsl] Processing Entity ' question
From: "Greg Alvord" <Greg.Alvord@xxxxxxxxxxx>
Date: Sat, 5 Feb 2005 16:58:16 -0600
I have been pulling what is left of my hair out this morning.  I hate to
bother this group with such a simple question.  I have looked in books and
at FAQ

Problem:  An XML element content has a single quote in it, as in "Broker's
ZIP".  In the file is it properly represented with  an internal entity.  The
XML looks like <LogicalFieldName>Broker&apos;s ZIP</LogicalFieldName>

The <xsl:output> is set to text.  I am writing SQL statements from the XML.
In Oracle to represent the single quote as content you use three single
quotes. For example

WHERE FLDNAME=' Broker'''s ZIP'.

I can not find the construction that will let me detect the existence of the
single quite.

Assume
<xsl:varable name=myValue select="Broker&apos;s ZIP"/>

The value is really pulled from the source document.  Showing the variable
content in StylusStudio debug shows the single quote is there. 

This construction works to find the 'r'
<xsl:if test="string-length(string-before($myValue,'r'))>0">

I have tried
<xsl:if test="string-length(string-before($myValue,'''))>0">   --- quoted
quote
and
<xsl:if test="string-length(string-before($myValue,'&apos;'))>0">  quoted
entity
and
<xsl:if test="string-length(string-before($myValue,'&#39;'))>0"> quoted
character encode

In each case it acts like there are missing end parenthesis, no doubt
because the odd number of single quotes act like one quote.  

Any ideas?

Greg

Current Thread