A Practical Guide to SharePoint 2013

A Practical Guide to SharePoint 2013
A Practical Guide to SharePoint 2013 - Book by Saifullah Shafiq

Wednesday, May 14, 2008

XPath, XQuery, and XSLT Functions

Some XML functions can be very useful in InfoPath, especially if you are an InfoPath developer. For example, suppose you are using data validation in your InfoPath form and you want the users to enter a value in one of the text boxes on your form. Of course, you can use the built-in data validation functions, for example, "If field is blank then show error alert" but users can dodge you by entering a space in the text box. In this case, InfoPath won't generate any error and will accept the value entered by the user. How can handle this situation? The answer is XML functions. You can use normalize-space() function. Right click the control and select "Data Validation". In the drop down, select "The expression" and in the text box enter normalize-space(.)="". In the screen tip, enter "Please enter valid value" and click Ok. InfoPath will now show an error if users try to enter an invalid value like a whitespace. Similarly, you can use other XML functions in your code or to validate data using the built-in data validation. More functions can be found on the following page. The page has the list of functions and examples to show how each function works:
 
-SSA