You will need an "=" sign in the first condition $lastNode = 'true', and you will need to spell "AND" as "and". XPath, like XML, is case-sensitive.
There are plenty of places where you can find information on XPath syntax, for example http://www.w3schools.com/xpath/default.asp
. This kind of question really doesn't justify a forum message, unless there was something specific in one of the reference sources that gave you problems.
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference