Re: [xsl] Processing Entity ' question

Subject: Re: [xsl] Processing Entity ' question
From: David Carlisle <davidc@xxxxxxxxx>
Date: Sun, 6 Feb 2005 01:20:33 GMT
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


(or equivalently

As far as XML is concerned, the above may as well be
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 '




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


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

   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.


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:

Current Thread