tag:help-archives.hannonhill.com,2010-02-09:/discussions/velocity-formats/242-xpath-helpCascade CMS: Discussion 2018-10-18T20:36:38Ztag:help-archives.hannonhill.com,2010-02-09:Comment/187273872012-09-13T15:01:12Z2012-09-13T15:01:12ZXpath help<div><p>I forgot to attach the xml of the page displaying the feed. I
know the problem is that I'm trying to pull the last name from the
data-structure of the page and use that value to select the expert
from the feed.</p></div>steelejtag:help-archives.hannonhill.com,2010-02-09:Comment/187273872012-09-13T16:03:36Z2012-09-13T16:03:36ZXpath help<div><p>Hi,</p>
<p>Based on your page XML, you will need to add a block chooser to
your page's Data Definition so that you also have access to the XML
from the feed. Also, in order for your Format to gain access to the
Block's content, you will need to specify a <em>Render Content
Depth</em> for the block chooser field (try using a value of
4).</p>
<p>For example, say you've added a block chooser called
<em>expertFeed</em>, something like the following Format should do
the trick:</p>
<pre>
<code>#set ($id = $_XPathTool.selectSingleNode($contentRoot, "//system-data-structure/lname"))
#set ($exp = $_XPathTool.selectSingleNode($contentRoot, "//expertFeed/content/system-page/expert[lname='${id.value}']"))
#set ($fname = $exp.getChild("fname").value)
#set ($lname = $exp.getChild("lname").value)
#set ($title = $exp.getChild("title").value)
#set ($dept = $exp.getChild("dept").value)
<div class="article-header"><!--start article-header div-->
<h1 class="expert-name">${fname} ${lname}</h1>
<p class="italic">${title}<br />
${dept}</p>
<div class="addthis_toolbox addthis_default_style addthis_16x16_style" id="addthis"><!-- Start AddThis Button -->
<a class="addthis_button_preferred_1" ></a>
<a class="addthis_button_preferred_2" ></a>
<a class="addthis_button_preferred_3" ></a>
<a class="addthis_button_preferred_4" ></a>
<a class="addthis_button_preferred_5" ></a>
<a class="addthis_button_compact" ></a>
</div>
<!-- End AddThis Button -->
</div><!--end article-header div--></code>
</pre></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/187273872012-09-13T16:52:31Z2012-09-13T16:52:31ZXpath help<div><p>Ryan,<br>
That helps. I have the feed xml in the page now but with your
script, for some reason I'm still not pulling data.</p></div>steelejtag:help-archives.hannonhill.com,2010-02-09:Comment/187273872012-09-13T17:04:56Z2012-09-13T17:04:56ZXpath help<div><p>I got it. Thanks. I had named the block chooser expertfeed, not
expertFeed. All set now.</p>
<p>I appreciate your help.</p></div>steelej