XSLT/XPath : No upper-case function in MSXML 4.0?

前端 未结 2 1677
广开言路
广开言路 2021-01-06 11:31

I try to use upper-case() in an XPATH, my parser is MSXML 4.0, and I get :

upper-case is not a valid XSLT or XPath function.

Is it really

2条回答
  •  难免孤独
    2021-01-06 11:52

    Maybe this can help you:

    translate(string, string, string)
    

    The translate function takes a string and, character-by-character, translates characters which match the second string into the corresponding characters in the third string. This is the only way to convert from lower to upper case in XPath. That would look like this (with extra white space added for readability). This code would translate the employee last names to upper case and then select those employees whose last names begin with A.

    descendant::employee[
     starts-with(
      translate(@last-name, 
          "abcdefghijklmnopqrstuvwxyz", 
          "ABCDEFGHIJKLMNOPQRSTUVWXYZ"), 
      "A"
     ) 
    ]
    

    If the second string has more characters than the third string, these extra characters will be removed from the first string. If the third string has more characters than the second string, the extra characters are ignored.

    (from http://tutorials.beginners.co.uk/professional-visual-basic-6-xml-part-1-using-xml-queries-and-transformations.htm?p=3)

提交回复
热议问题