1

I have a problem with drupal migrate, i'm trying migrate content with this xpath:

item_xpath = '/import/content/contentInstance[@contentTypeId=\'ac1ssss___\' @window=\'blank\]';

when i execute drush ms return 0 results, however if i use only one condition in item_xpath:

item_xpath = '/import/content/contentInstance[@contentTypeId=\'ac1ssss___\']';

Return 15 results

'/import/content/contentInstance[**@contentTypeId=\'ac1ssss___\' @window=\'blank\]';

Return 10 results

The xml have content with two attributes, not migrate allows two conditions as attribute?

Thanks for all.

8
  • I'm not sure how this is a Drupal question (XPath is its own language, Drupal doesn't change it). Have you tested your expressions outside Drupal? Do they work? Have you read through examples, like this?
    – Clive
    Commented Mar 23, 2016 at 10:24
  • Sorry item_xpath is: item_xpath = '/import/content/contentInstance[@contentTypeId=\'ac1ssss___\' and @window=\'blank]'; but does not works
    – Jose
    Commented Mar 23, 2016 at 10:28
  • And it does work outside Drupal when you just run that expression against your test string? That's very strange. I'd say you've found a bug in the migrate module
    – Clive
    Commented Mar 23, 2016 at 10:30
  • Yes, if i use same files with xpath evaluator works but drupal migrate doesnt works , maybe are a bug ?
    – Jose
    Commented Mar 23, 2016 at 10:37
  • Yes if your XPath expression is valid, and it doesn't work in a particular module, that's got to be a bug in the module (or PHP's XPath processor). I would double and triple check, though, according to the link I posted above your expression isn't a valid way to query by multiple attributes on the same element
    – Clive
    Commented Mar 23, 2016 at 11:08

1 Answer 1

0

You don't mention what XML source plugin you're using - is it MigrateSourceXML? If so, note that (as documented), it does not read in the entire XML file thus general-purpose xpath is not available, it implements a limited subset of xpath syntax for selecting the items to import. You should use MigrateSourceMultiItems when you need full xpath syntax.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.