I'm having trouble using certain functions of XPath. My XML is as follows:

<rss>
  <channel>
    <item>
        <title>My Title</title>
        <link>http://www.example.com/myaudiofile.mp3?CAMEFROM=thisfeed</link>
        <category>apples, oranges, PEARS</category>
    </item>
  </channel>
</rss>

1. I want to remove the decoration ?CAMEFROM=thisfeed from the URL. I tried the following two examples without any success (I'd prefer to use the first as the second would cause problems if the link had no decoration):

substring-before(concat(link, '?CAMEFROM=thisfeed'), '?CAMEFROM=thisfeed')

substring-before(link, '?CAMEFROM=thisfeed')

2. Secondly I want to force all categories to be lower case.

translate(category, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')

Both these examples result in empty fields. Is this a limitation of SimpleXMLElement or should I be going about this in a different way?