title: XSLT to lookup values in one XML and replace in another XML file
body: <p>One of the products we work with is able to output configuration information as XML, but, in that output file, instead of including actual host identifiers (names), they use a kind of GUID reference for each of the identifiers.</p>
  
  <p>I have made an XML file that contains the "mapping" between the host identifiers GUIDs and the actual host identifiers(lookup), and I want to implement an XSLT that will go through the configuration file and replace all of the host identifier GUIDs with the host identifier names, which it would lookup from the other XML file I made (lookup.xml).</p>
  
  <p>Here's what the lookup.xml file looks like:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;hostids&gt;
  
    &lt;hostid name="e687903c-d185-4560-9117-c60f386b76c1"&gt;Agent&lt;/hostid&gt;
    &lt;hostid name="b9230962-13ca-4d23-abf8-d3cd1ca4dffc"&gt;test2&lt;/hostid&gt;
  
  &lt;/hostids&gt;
  </code></pre>
  
  <p>and here is what the configuration file looks like (I ran the original file through some processing to get this):</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;resources&gt;
  
    &lt;resource&gt;&lt;host&gt;e687903c-d185-4560-9117-c60f386b76c1&lt;/host&gt;&lt;url&gt;/console/**&lt;/url&gt;&lt;/resource&gt;
    &lt;resource&gt;&lt;host&gt;b9230962-13ca-4d23-abf8-d3cd1ca4dffc&lt;/host&gt;&lt;url&gt;/ServiceByName&lt;/url&gt;&lt;/resource&gt;
  
  &lt;/resources&gt;
  </code></pre>
  
  <p>and here is what the output should look like:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;resources&gt;
  
    &lt;resource&gt;&lt;host&gt;Agent&lt;/host&gt;&lt;url&gt;/console/**&lt;/url&gt;&lt;/resource&gt;
    &lt;resource&gt;&lt;host&gt;test2&lt;/host&gt;&lt;url&gt;/ServiceByName&lt;/url&gt;&lt;/resource&gt;
  
  &lt;/resources&gt;
  </code></pre>
  
  <p>I am working with xsltproc on a RedHat machine, which is XSLT 1.0, I think.</p>
  
  <p>I have tried to get this working with several different example XSLTs that I found here, e.g.:</p>
  
  <p><a href="https://stackoverflow.com/questions/22415645/xslt-replace-values-with-another-file-matching-by-attribute">XSLT &quot;replace&quot; values with another file matching by attribute</a></p>
  
  <p>but haven't been able to get any of them working.</p>
  
  <p>Can anyone provide an XSLT 1.0 example that might be able to accomplish this?</p>
  
  <p>P.S.  This is another thread that had examples and the XSLT 1.0 examples wouldn't work for me.  When I ran it (after modifying to match my element names, etc.), it looks like it just wrapped the entire original XML in .</p>
  
  <p><a href="https://stackoverflow.com/questions/4994919/how-to-use-attribute-values-from-another-xml-file-as-an-element-value-selection">How to use attribute values from another XML file as an element value selection in the current XML</a></p>