[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Processing Entity ' question

Subject: Re: Processing Entity ' question
From: David Carlisle <davidc@xxxxxxxxx>
Date: Sun, 6 Feb 2005 01:20:33 GMT
apos entity
Are you using XSLT2/Xpath2?

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

No (unless you are using Xpath2, which I suspect isn't the case)
All three of the things you tried are equivalent to ''' (enity and
character references are expanded before Xpath is parsed) so are an
empty string followed by a trailing ' which is a ayntax error.

The FAQ has entries on this but basically, start from the Xpath you need
and worry about xml quoting later.

You want the string literal "'" (you have to use " to delimit a string
literal involving a ' in Xpath 1)
so you want the XPath

string-length(string-before($myValue,"'"))>0

(or equivalently
  starts-with($myValue,"'")
)

As far as XML is concerned, the above may as well be
jhgkjg"nbfjh'
just some random string involving " and '
to get that into an attribute you always have two choices
delimit with " and quote any " or delimit with ' and quote any '

so
test="string-length(substring-before($myValue,&quot;'&quot;))>0"

or

test='string-length(substring-before($myValue,"&apos;"))>0'

If you are using Xpath2 then a doubleed ' (or ") counts as a single ' in
a string literal so you could then do

test='string-length(substring-before($myValue,''''))>0'

which avoids using xml quotes at all, although I'm not sure it's any
more readable.

Incidentally
   In the file is it properly represented with  an internal entity.  The
   XML looks like <LogicalFieldName>Broker&apos;s ZIP</LogicalFieldName>

You could of course use ' rather than &apos;; in the source although
that wouldn't change the XSLT required.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.