I am trying to initialize collection view its showing incompatible type. I have written below code

```
UICollectionView * collCobj = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 260, 320, 230) collectionViewLayout:UICollectionViewScrollPositionLeft];

```
['https://Stackoverflow.com/questions/20237917', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2742598/']
There are multiple smaller problems with your codes.

1. Names in authors and books XML files do not match. I guess it's only some typos.
2. Predicates belong to an axis step, not in their own (remove the slash after `book` in line one).
3. XML and XQuery are capitalization sensitive! `<Book/>` uses a capital B, so do the same in your XQuery, again in line 1.
4. In Line two, you're looping over all `<authorRoot/>` elements. Use `authorRoot/author` instead.
5. In line three you're hiding the book `$p` with it's name for the rest of this FLWOR expression, but you want to use the book again in line five. Better use another variable name.
6. Better do not use the `descendant-or-self`-step `//` if you don't need it (lines one and two). This decreases performance.

I don't get what your idea for filtering was in lines three to five. Compare yourself with this working solution. Additionally I used speaking variable names, don't confuse yourself with unnecessary short ones.

Replace `$book` and `$authors` by the respecting `doc(...)` functions.

```none
for $book in $books//library/Book[title/contains(.,   'Title1')]
for $author in $authors//authorRoot/author
where $book/author = $author/Name
return $author/Location/text()

```

If you want to have a list of distinct places, wrap `distinct-values(...)` around all four lines.

An alternative without explicit loops:

```none
$authors/authorRoot/author[
  Name = $books/library/Book[contains(title, 'Title1')]/author)
]/Location

```

The second solution is also valid XPath 1.0, the first requires an XPath 3.0 or XQuery processor.
If you use

```
let $books := <library>
   <Book>
     <title>Title1</title>
     <author>Ellizabith</author>
   </Book>
   <Book>
     <title>Title2</title>
     <author>Sam</author>
   </Book>
   <Book>
    <title>Title3</title>
    <author>Ryan</author>
   </Book>
</library>
let $authors := <authorRoot>
   <author>
    <Name>Rayan</Name>
     <Location>Yahoo</Location>
    </author>
    <author>
      <Name>Syan</Name>
      <Location>Google</Location>
    </author>
    <author>
      <Name>Sam</Name>
      <Location>Bing</Location>
     </author>
     <author>
         <Name>Ellizabith</Name>
         <Location>Apple</Location>
    </author>
    </authorRoot>
    return $authors/author[Name = $books/Book[contains(title, 'Title1')]/author]/Location/string()

```

the result is `Apple`.