Subject: Re: [xsl] Contains - where contained From: "Mark Williams" <mark@xxxxxxxxxxx> Date: Mon, 26 Jan 2004 11:33:15 -0000 |
Thanks Michael and Andrew very much for your responses. I think what I probably need to do is get my hands on Michael's book Regards, Mark ----- Original Message ----- From: "Andrew Welch" <AWelch@xxxxxxxxxxxxxxx> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Sent: Monday, January 26, 2004 11:12 AM Subject: RE: [xsl] Contains - where contained > Is there an easy way to test not only whether one strings > contains another, but if the position of the contains is at > the start of the taret string, at the end or somewhere other > than the start and the end. To test if one string contains another: test="contains(.,$string) To test if one string is at the start of another string: test="not(string-length(normalize-space(substring-before(.,$string))))" Combine the two: test="contains(.,$string) and not(string-length(normalize-space(substring-before(.,$string))))" To do what you are asking use a choose/when with the start and end tests first, and the middle test falling into the otherwise. You may want to remove the normalize-space() if you would treat "hello" and " hello" differently. You probably also would want to translate() to the same case before comparing as well. andrew XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Contains - where containe, Andrew Welch | Thread | [xsl] copying attributes to all chi, Terence Mac Goff |
RE: [xsl] Contains - where containe, Andrew Welch | Date | Re: [xsl] copying attributes to all, George Cristian Bina |
Month |