Interesting part of the XML document:
<sessionextension name="Relational Writer" sinstancename="KDS_E_PART_PARTEI" subtype="Relational Writer" transformationtype="Target Definition" type="WRITER">
<connectionreference cnxrefname="DB Connection" connectionname="" connectionnumber="1" connectionsubtype="" connectiontype="Relational" variable="$DBConnection_Tgt">
<attribute name="Target load type" value="Bulk">
<attribute name="Insert" value="YES">
<attribute name="Update as Update" value="NO">
<attribute name="Update as Insert" value="NO">
<attribute name="Update else Insert" value="NO">
<attribute name="Delete" value="NO">
<attribute name="Truncate target table option" value="YES">
</attribute></attribute></attribute></attribute></attribute></attribute></attribute></connectionreference></sessionextension>
It is the ATTRIBUTE element. So my working query is(: constant definition :)
let $indent := " "
let $linebreak := "
"
(: main :)
(: walk the worklets :)
for $writer in /POWERMART/REPOSITORY/FOLDER/WORKLET/SESSION/SESSIONEXTENSION[@TYPE = "WRITER" and (starts-with(@SINSTANCENAME, "KDS_E_") or starts-with(@SINSTANCENAME, "KDS_I_") or starts-with(@SINSTANCENAME, "KDS_S_") or starts-with(@SINSTANCENAME, "KDS_T_"))]
where ($writer/CONNECTIONREFERENCE[@VARIABLE != "$DBConnection_Staging"] and $writer/ATTRIBUTE[@NAME = "Truncate target table option" and @VALUE = "YES"])
return
concat($writer/../../@NAME
,$linebreak
,$indent
,$writer/../@NAME
,$linebreak
,$indent
,$indent
,$writer/@SINSTANCENAME
,$linebreak
,$indent
,$indent
,$indent
,"Connection: "
,$writer/CONNECTIONREFERENCE/@VARIABLE
,$linebreak
,$indent
,$indent
,$indent
,"Truncate target table option: YES"
)
Initially I tried to have the analogous solution to the CONNECTIONREFERENCE solution for the ATTRIBUTE element but within the concat function it throws mentioned exception