Nested conditional if else statements in xpath
I have this XML: <property id="1011"> <leasehold>No</leasehold> <freehold>Yes</freehold> <propertyTypes> <propertyType>RESIDENTIAL</propertyType> </propertyTypes> </property> and I want to create an xpath statement that is same as the following nested if-else pseudocode block. if( propertyTypes/propertyType == 'RESIDENTIAL') { if( leasehold == 'Yes' ){ return 'Rent' } else return 'Buy' } } else { if( leasehold == 'Yes' ){ return 'Leasehold' } else return 'Freehold' } } I've seen something about Becker's method but I couldn't really follow it. XPath isn't my strong point really. I. In XPath 2.0