It's strange, max
doesn't work on string attributes/elements:
select (select cast('<A D="1"/>' as xml)).query('max(/A/@D)')
-- returns 1
select (select cast('<A D="a"/>' as xml)).query('max(/A/@D)')
-- returns nothing
some workaround could be using variable:
declare @Time nvarchar(max)
select @Time = max(T.C.value('@Time', 'nvarchar(max)'))
from @Data.nodes('DataItems/CalculationHistory/Seller') as T(C)
select @Data.value('(/DataItems/CalculationHistory/Seller[@Time=sql:variable("@Time")]/@Revision)[1]', 'int')
I'll try to check later if it's possible to use max on strings in SQL Server xpath