Skip to main content

I have multiple xml files, each with the same structure as shown below:

 <Metadata>

   <MDI key="MAXIMUM">9</MDI>

   <MDI key="MEAN">4.2018685725509</MDI>

   <MDI key="MINIMUM">0</MDI>

   <MDI key="STDDEV">2.3097856863945</MDI>

  </Metadata>

I want to create a table with using the MDI Keys as the column names, and the element values as the rows from all the xml files, as illustrated below. Can do a single file with AttributeTransposer, but could not figure out a simple way to load all the files together, feeling awkward with limited knowledge of FME XML transformers. Need some expert help here.

 Capture

If you have a list of the filepaths, you can use an XMLXqueryExtractor, use the filepath as your XML input with XML Input set to XML File then 

for $m in //MDI
return fme:set-attribute($m/@key, $m/text())

Expose the MAXIMUM, MINIMUM,STDDEV & MEAN under the Attributes to Expose Parameter


If you have a list of the filepaths, you can use an XMLXqueryExtractor, use the filepath as your XML input with XML Input set to XML File then 

for $m in //MDI
return fme:set-attribute($m/@key, $m/text())

Expose the MAXIMUM, MINIMUM,STDDEV & MEAN under the Attributes to Expose Parameter

Learned something new today :)


If you have a list of the filepaths, you can use an XMLXqueryExtractor, use the filepath as your XML input with XML Input set to XML File then 

for $m in //MDI
return fme:set-attribute($m/@key, $m/text())

Expose the MAXIMUM, MINIMUM,STDDEV & MEAN under the Attributes to Expose Parameter

@ebygomm, brilliant, works like a charm. I wish I knew XQuery more. Thanks a bunch.


Reply