Example 5: Setting HTML Attribute Value by XPath API Function

You can use EXPRESSION to generate attribute values for HTML elements:

<img alt="" src="<!--{= X.value('//img[1]/@src') }-->" />

This example generates src attribute for the IMG element taken from the original page.