I imagine this issue has a pretty simple solution, but after searching for an answer for a few days, I figured I'd post. I'm still kind of a Drupal novice.

I am importing research publications (XML file) and am having an issue. In the XML file (which I don't have control over) the general structure looks like this:

<record>
     <titles>
          <title>TITLE</title>
     </titles>
     <contributors>
          <authors>
               <author>AUTHOR</author>
               <author>AUTHOR</author>
               <author>AUTHOR</author>
               <author>AUTHOR</author>
          </authors>
     </contributors>
</record>

In my publications content type, I have a Title field and an Authors field.

I'm using the following xpath parser settings to import:

Title: titles/title
Authors: contributors/authors/author

With these settings I get the title in Title, and I get the first author in the list in Authors. Is there any way to get all of the authors in that field or is that outside the scope of possibility?

Comments

blogook’s picture

Not sure but perhaps the link below might help you out;

http://www.tizag.com/xmlTutorial/xpathbar.php

mgwisni’s picture

This is an okay work around for now because I can target the xml fields sequentially, but each publication doesn't have the same number of authors, so I think that will be an issue.

contributors/authors[1] | contributors/authors[2] | contributors/authors[3]

It doesn't seem like a good solution though.

blogook’s picture

Agreed. It would be an extremely nice addition if we were able to add a simple loop in our mappings.

dawnbuie’s picture

I think it's supposed to work with multiple values automatically. Please correct me if I'm wrong.

Does this help http://drupal.org/node/1108220?

for:

<item>
  <enclosure url="http://www.example.com/path-to-image/image1.jpg" type="image/jpeg"/>
  <enclosure url="null" type="image/jpeg"/>
  <enclosure url="null" type="image/jpeg"/>
  <title>Demo title 2</title>
</item>

@twistor suggested using:

enclosure[./@url != 'null']/@url

that implies looping to me. But I too am new to this module.

mgwisni’s picture

It actually looks like it was importing all the authors from the start, but I wasn't able to see all of them until I made the field I was importing into a Text Area instead of a text field. So hopefully this is all good for now!

jadhavdevendra’s picture

Issue summary: View changes

#5 did not work for me.

I don't think this is a bug.

You need to install feeds tamper module and use Implode plugin.

I think this bug can be closed.