XML.cfg Apply Metadata from Parent to all children

Is it possible to configure xml.cfg to apply metadata from a parent node to all children under that node?

 

For example, we have the following structure in an XML source:

<results count="123" date-accessed="abc" source="xyz">
  <person>
    <name></name>
    <title></title>
    ...
  </person>
  <person>...</person>
  ...
</results>

I've set up xml.cfg so it's storing name, title, etc data fine, no issues.  What I'm trying to do, though, is get the values for date-accessed and source also stored against each 'person' record.  I have tried the following (based on a metadata class 'f'):

f,0,,//results@source

– AND –

f,0,/results@source

Neither picked up anything. 

 

I can workaround it by creating an xsl and transforming the results, but that seems like taking a sledge-hammer when perhaps only a trowl is needed.

Hi Tim - 

 

The preferred method for achieving this will be an XML structure like:

<results>
  <person>
    <date-accessed>abc</date-accessed>
    <source>xyz</source>
    <name></name>
    <title></title>
    ...
  </person>
  <person>
    <date-accessed>abc</date-accessed>
    <source>xyz</source>
    ...
  </person>
  ...
</results>

Alternatively, if these records have predictable URL patterns from a 'URL' element, and it's mapped to 'docurl' in xml.cfg, you could apply the metadata in batches via external metadata.

Thanks Gordon.  That format you've given is how I would have done it as well, but I'm using Matrix as an intermediary and it seems to have a bug.  I've already posted on the forums about that (see http://forums.squizsuite.net/index.php?showtopic=12814&hl=). If that gets resolved then I can do it using the format you've suggested.  This post was the workaround for that bug I was trying to achieve.  (EDIT: excuse my yoda-talk there.  I mean "This post in Funnelback forum comes as a result of trying to workaround the bug I posted about in the Matrix forum").

 

Since I have control over the XML format, I wonder if I could ensure a consistent URL patter....  Hmmm, food for thought.  I thought external-metadata didn't work for XML data sources.  Good to know that I could use it after all.

 

Cheers