[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] Processing Entity ' question
Subject: RE: [xsl] Processing Entity ' question From: "Greg Alvord" <Greg.Alvord@xxxxxxxxxxx> Date: Sun, 6 Feb 2005 09:14:03 -0600 |
Thank you very much. Sorry I forgot to say XSL 1.0, but you figured it out correctly. Greg -----Original Message----- From: David Carlisle [mailto:davidc@xxxxxxxxx] Sent: Saturday, February 05, 2005 7:21 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] Processing Entity ' question 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,"'"))>0" or test='string-length(substring-before($myValue,"'"))>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's ZIP</LogicalFieldName> You could of course use ' rather than '; 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Processing Entity ' , David Carlisle | Thread | RE: [xsl] Processing Entity ' , Pawson, David |
RE: [xsl] browser error when using , Michael Kay | Date | RE: [xsl] Decimal precision, Michael Kay |
Month |