Here is how to do it correctly.
You can apply the same technique in both XQuery methods: .value()
and .nodes()
SQL
DECLARE @Data XML = N'<root>
<column id="1" isok="true">OK</column>
<column id="2" isok="false">NOT OK</column>
<column id="3" isok=" TRUE ">OK</column>
<column id="4" isok=" false">NOT OK</column>
</root>';
SELECT c.value('@id', 'INT') AS [id]
, c.value('@isok', 'VARCHAR(10)') AS [isok]
, c.value('(./text())[1]', 'VARCHAR(10)') AS [column]
FROM @Data.nodes('/root/column[(fn:lower-case(@isok) cast as xs:token?) = "true"]') AS t(c);
Output
+----+------------+--------+
| id | isok | column |
+----+------------+--------+
| 1 | true | OK |
| 3 | TRUE | OK |
+----+------------+--------+