using contains() in XSLT (XPATH)

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
ihateevilbill
Forum Commoner
Posts: 29
Joined: Fri Nov 14, 2003 5:57 am

using contains() in XSLT (XPATH)

Post by ihateevilbill »

I am trying to check if a nodes text ends in either .gif or .jpg I have tried several different ways and still not working. (I have been using the XPATH contains() method so far without any luck).

I know that from an XML stream that
barceloDS_responses/response/establishment/characteristics/room_photo
will either hold either a gif a jpg or neither. Thing is I cant check the node to see if its empty because if there is no picture available then the text in the node comes back as http://barcelobl/blah/blah (which changes from node to node).

So my question basically is how the heck do I check to see if the nodes text ends with jpg or gif? If it ends with something else i.e a '/' mark or something then I just wont display the picture. I have already tried concat and it didnt work....the xslt so far looks like <xsl:value-of select="format-number(amount * 1.25, '#.00','euro')" />.

:)

Cheers for the help.....this is a biggy :S
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Have you tried using substring-after()?

Mac
ihateevilbill
Forum Commoner
Posts: 29
Joined: Fri Nov 14, 2003 5:57 am

Post by ihateevilbill »

nope, but thats me looking it up now m8, cheers
Post Reply