I think you almost got it. If you want to convert a string to integer, you can create a variable of type integer and use parseInteger($s_id). Then use that variable in XPATH. But please do remember this compromise the security of the application.
Another standard way to do this if you are not too stubborn with ID implementation:
[id = $Id] isn’t working?
What I am wondering is, why do you need the id? Did you don’t have an object?
You can create a java action and retrieve the object using the retrieveId method:
The Validation Feedback Collector in the appstore has a Java Action that will just do that.