AnsweredAssumed Answered

Global Search

Question asked by jlmarques on Feb 22, 2008
Latest reply on Feb 25, 2008 by jlmarques
Hey there, I setup two web forms so that I can produce two types of content: pages and articles, they have distinct formats, but share some common properties, like title, author and body.

I am able to retrieve the results using this ftl:

<#list resultset as node>
    <ul>
   <#if node.isDocument>
      <li>${node.name} - ${xmldate(node.properties.modified)}</li>
    </#if>
    </ul>
</#list>

But obviosly I have no interest in getting the document properties, I want access the data inside the xml:


<#list resultset as node>
    <#if node.isDocument>
      <#assign dom=node.xmlNodeModel>
      <#if dom.page.title??>
            <h2>${dom.page.title}<h2>
            <p>${dom.page.body}<p>
      </#if>
      <#if dom.article??>
            <h2>${dom.article.title}<h2>
            <p>${dom.article.body}<p>
      </#if>      
    </#if>
</#list>

I get this error:
freemarker.core.NonStringException - Error on line 5, column 39 in cms/search/search.get.html.ftl Expecting a string, date or number here, Expression dom.page.title is instead a freemarker.ext.dom.NodeListModel

What can I do to bypass this?

I've tried using ${(dom.page.title)!} but still get the same error, obviously dom.page.title exists but it's not a string, date or number type.
I'm kind of stuck here.
:roll:

Outcomes