XML from Data Base Examples tutorial
Making an XML element with attributes XML element with attributes

## Example 3

This example shows a use of the XMLELEMENT() for creating the xml element 'Emp' with three attributes - 'EmployeeID', 'firstname' and 'lastname' getting their values from the 'EmployeeID', 'FirstName' and 'LastName' columns, respectively. The pairs of attribute and its value are produced by XMLATTRIBUTES() function. If a parameter of the XMLATTRIBUTES() has no 'as clause', Virtuoso uses the partially escaped form of the column name as the attribute name.

    select
         XMLELEMENT ("Emp", XMLATTRIBUTES ("EmployeeID", "FirstName" as "firstname", "LastName" as "lastname"))
    from "Demo"."demo"."Employees";