sql server – OPENXML to get content by using element and attribute name

In this SQL Server OPENXML example:

declare @xmldata xml    

set @xmldata = 
'<?xml version="1.0"?>
<wddxPacket version="1.0">
        <var dimension="task"><string>Task 1</string></var>
        <var dimension="startdate"><string>2020-11-14</string></var>
        <var dimension="startdate"><string>2020-11-15</string></var>
        <var dimension="task"><string>Task 2</string></var>

DECLARE @hDoc int
EXEC sp_xml_preparedocument @hDoc OUTPUT, @xmldata

FROM OPENXML(@hDoc, '//wddxPacket/data',2)
            task          varchar(200) 'var(1)/string',
            startdate     varchar(200) 'var(2)/string'

EXEC sp_xml_removedocument @hDoc

This is the current output:

task         startdate
------       ----------
Task 1       2020-11-14
2020-11-15   Task 2   

But I really want this output:

task         startdate
------       ----------
Task 1       2020-11-14
Task 2       2020-11-15

To identify the content, I cannot use “var” alone, because all elements of interest are named “var”. I cannot use position (1) or (2), because the position numbers are inconsistent in the XML, resulting in the current mixed-up output. How do I identify the elements based on “var” and the “dimension” attribute names of “task” or “startdate”?