Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • [email protected] 378 posts 1915 karma points MVP 4x c-trib
    Jan 10, 2012 @ 16:37
    jeffrey@umarketingsuite.com
    0

    uComponents GetNodesByXPath lowercase comparison

    Hi guys,

    I'm using the uComponents-function GetNodesByXPath and I want to search in all nodes for a property with a value that matches my variable. My variable is always lowercase, but the propertyvalue isn't. How can I compare it case-insensitive.

    I thought that something like this would work

    For Each Node In uComponents.Core.uQuery.GetNodesByXPath("//* [@isDoc and Exslt.ExsltStrings:lower-case(merk)='" + merk + "']")

    But this gives the following exception

    Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function.

    I don't know how I can add a namespacemanager/xslcontext in this function. I hope someone can help me,

    Jeffrey

     

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Jan 10, 2012 @ 16:58
    Lee Kelleher
    0

    Hi Jeffrey,

    Unfortunatelly you can't add/change the XsltContext to use custom namespaces/extension-methods ... (if there is a way to do it, I'd love to know!)

    The alternate option is to use native XPath functions - in your case the "translate()" function.

    uComponents.Core.uQuery.GetNodesByXPath("//*[@isDoc and translate(merk, \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\", \"abcdefghijklmnopqrstuvwxyz\") = '" + merk.ToLower() + "']")

    Cheers, Lee.

  • [email protected] 378 posts 1915 karma points MVP 4x c-trib
    Jan 10, 2012 @ 17:03
    jeffrey@umarketingsuite.com
    0

    Hi Lee,

    This works for now.

    Thanks!

    Jeffrey

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies