MS SQL DB design help I'm stuck with table design and query FOR XML

Sync engine for Ads requires XML schema in this format

&lt;attribute1&gt;value&lt;/attribute1&gt;
&lt;attribute2&gt;value&lt;/attribute2&gt;…
&lt;lookup_list&gt; 
&lt;lookup_item code="installations"&gt;220&lt;/lookup_item&gt; 
&lt;lookup_item code="heating"&gt;228&lt;/lookup_item&gt; 
&lt;lookup_item code="permits"&gt;233&lt;/lookup_item&gt; 
&lt;lookup_item code="parking"&gt;162&lt;/lookup_item&gt; 
&lt;lookup_item code="garden"&gt;166&lt;/lookup_item&gt; 
&lt;lookup_item code="electronics"&gt;167&lt;/lookup_item&gt; 
&lt;/lookup_list&gt;
&lt;attributeN&gt;value&lt;/attributeN&gt;…


That lookup list is separate table that looks like this: 

Lookup_item_id  code            lookup_item_title
220         ad_flat.installations   Town gas
221         ad_flat.installations   City water
224         ad_flat.heating_type    gas
226         ad_flat.heating_type    wood


For normal attributes I created this FOR XML query with sub-query for images that are in other table, 

    SELECT
    attribute1,
    attribute2,
    (SELECT
    images.image_name AS image
    FROM images
    WHERE images.realestateID = realestates.ID
    FOR XML PATH (''), TYPE
    ) AS 'image_list'
FROM (SELECT DISTINCT 
* 
FROM realestates) realestates
FOR XML PATH ('ad_item'), ELEMENTS, root ('ad_list')


but for this lookup_list I have no idea how to design table and relations for that and how to write a query FOR XML export, please if someone have an idea I will be very grateful.
The inner part you can create like this

DECLARE @table TABLE(Lookup_item_id INT, code VARCHAR(100),lookup_item_title VARCHAR(100));
INSERT INTO @table  VALUES
 (220,'ad_flat.installations','Town gas')
,(221,'ad_flat.installations','City water')
,(224,'ad_flat.heating_type','gas')
,(226,'ad_flat.heating_type','wood');

SELECT t.code AS [@code]
      ,t.Lookup_item_id AS [*] 
FROM @table AS t
FOR XML PATH('lookup_item'),ROOT('lookup_list');


The result

&lt;lookup_list&gt;
  &lt;lookup_item code="ad_flat.installations"&gt;220&lt;/lookup_item&gt;
  &lt;lookup_item code="ad_flat.installations"&gt;221&lt;/lookup_item&gt;
  &lt;lookup_item code="ad_flat.heating_type"&gt;224&lt;/lookup_item&gt;
  &lt;lookup_item code="ad_flat.heating_type"&gt;226&lt;/lookup_item&gt;
&lt;/lookup_list&gt;


This you can integrate into your select within paranthesis like a column (scalar sub-select).