tag:help-archives.hannonhill.com,2010-02-09:/discussions/how-do-i/21876-how-do-i-get-this-part-of-the-xmlCascade CMS: Discussion 2018-10-18T20:37:54Ztag:help-archives.hannonhill.com,2010-02-09:Comment/397272752016-04-25T20:17:53Z2016-04-25T20:17:53ZHow do I get this part of the XML?<div><p>Hi,</p>
<p>If you are using XSLT, the Format would look something like:</p>
<pre>
<code><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output indent="yes"/>
<xsl:template match="/system-index-block">
<xsl:apply-templates select="system-page"/>
</xsl:template>
<xsl:template match="system-page">
<xsl:value-of select="title"/>
<img>
<xsl:attribute name="src"><xsl:value-of select="system-index-block/Image/link"/></xsl:attribute>
</img>
<xsl:copy-of select="system-index-block/Default/node()"/>
</xsl:template>
</xsl:stylesheet></code>
</pre>
<p>If you are using Velocity, the Format would look something
like:</p>
<pre>
<code>#set ($pages = $_XPathTool.selectNodes($contentRoot, "/system-index-block/system-page"))
#if ($pages.size() > 0)
#foreach ($page in $pages)
#set ($pageSD = $page.getChild("system-data-structure"))
#set ($default = $pageSD.getChild("Default"))
#set ($image = $pageSD.getChild("Image"))
$_EscapeTool.xml($page.getChild("title").value)
<img src="${image.getChild('link').value}" />
$_SerializerTool.serialize($default, false)
#end
#end</code>
</pre>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/397272752016-04-25T20:29:41Z2016-04-25T20:29:41ZHow do I get this part of the XML?<div><p>Wow... shockingly, that worked, even though I'm virtually
positive I tried that exact code first. BTW, what does the whole
EscapeTool and SerializerTool line do?</p></div>webadmintag:help-archives.hannonhill.com,2010-02-09:Comment/397272752016-04-25T20:32:17Z2016-04-25T20:32:17ZHow do I get this part of the XML?<div><p>Thank you for following up, I am glad to hear the snippet I
provided did the trick.</p>
<p>The <a href="http://www.hannonhill.com/kb/Script-Formats/#escape-tool">Escape
Tool</a> will escape certain characters to ensure the content being
output contains valid XML. The <a href="http://www.hannonhill.com/kb/Script-Formats/#serializer-tool">Serializer
Tool</a> converts XML data to text.</p>
<p>I'm going to go ahead and close this discussion, please feel
free to comment or reply to re-open if you have any additional
questions.</p>
<p>Have a great day!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/397272752016-04-25T20:42:12Z2016-04-25T20:42:12ZHow do I get this part of the XML?<div><p>Sorry, one more thing to ask. Why do you have to have brackets
around the image link request? I tried it without them, and I get
nothing back, and I can't quite figure out why.</p></div>webadmintag:help-archives.hannonhill.com,2010-02-09:Comment/397272752016-04-25T21:20:55Z2016-04-25T21:20:55ZHow do I get this part of the XML?<div><p>Are you referring to the use of curly braces here?</p>
<pre>
<code> <img src="${image.getChild('link').value}" /></code>
</pre>
<p>If so, it's because you're embedding the expression inside of
markup that you're wanting to output and our parser has to know
where your expression begins/ends and what to treat as a string
literal.</p>
<p>Please let me know if that makes sense.</p>
<p>Thanks!</p></div>Bradley Wagnertag:help-archives.hannonhill.com,2010-02-09:Comment/397272752016-04-25T21:34:48Z2016-04-25T21:34:48ZHow do I get this part of the XML?<div><p>That makes sense... I assumed that's what it was, so I tried to
get the link value out of the $image item directly, and it wouldn't
come out. No matter, I got it working now. Thanks!</p></div>webadmin