I am using xpath in pyspark to extract from xml which is stored as a column in a table.
Below works fine
entity_id="D8"
dfquestionstep=df_source_xml.selectExpr("disclosure_entity_id",
f'xpath(**xml**,"*/entities/entity[@type=\'TI\']/entity[@type=\'UNDERWRITING\']/entity[@type=\'DISCLOSURES\']/entity[**@id=\'{entity_id}\'**]/entity[@type=\'DECISION_PATH\']/entity[@type=\'QUESTION_STEP\']/@id") QUESTION_STEP_ID'
)
PROBLEM
Now I want to pass disclosure_entity_id which is a column in dataframe having values like D8, D9 etc. in place of entity_id, i.e. entity[@id=disclosure_entity_id]
But all I get is [] as result when I execute like this, i.e. xpath fails to find anything.
Is there a way to pass the DF column directly as argument to XPATH like above?