Find all elements which contain the text "true" and count them.
count(//my:templateBase/*[text() = 'true'])
Make sure to correctly register the namespace or use *
instead of my
as wildcard namespace, for example
count(//*:templateBase/*[text() = 'true'])
I do not know Infopath, maybe it also just omits namespaces.
If you also want to search subnodes for the text "true", use
count(//my:templateBase//*[text() = 'true'])