I originally wrote a simple XQuery script:
$mediaNodes := doc('/db/portfolio/media_data_101109.xml'),
$query := concat('$mediaNodes//media[contains(@product,"',$product,'")'
Basically, what he does is first get the xml file for multimedia records. Then I created a query that looked through all media nodes (elements of an XML file) and matched the @product attribute with what the user set in the browser, and I used it, so there is no need to make exact matches.
Now I want to expand this a bit to ignore the case. Therefore, no matter in which case the user typed the browser, I will convert it to lowercase, and I will also convert the node text to lowercase.
I searched on the Internet and found the function in lowercase and changed my code accordingly:
$query := concat('$mediaNodes//media[contains(lower-case(@product),"',lower-case($product),'")',
but this will not work if I execute the request, heap overflow will occur. The request I received after working with the product = wborc looks like this:
$mediaNodes//media[contains(lower-case(@product),"wborc")]
Can someone help me a little? I am not sure if I am making a syntax error or a logical one. Thanks in advance.
Kevin source
share