Getting Image Path
I'm trying to get an image path but it doesn't seem to be working.
XML:
<system-data-structure>
<page-element>
<include-header>
<value>Yes</value>
</include-header>
<content-type>Text (w/ Supporting Media)</content-type>
<header>
<text>This is the header</text>
<heading-level>Heading 2</heading-level>
</header>
<text>
<content>
<p>Text
<strong>Here</strong>
</p>
<p>
<span style="text-decoration: underline;">
<strong>And Here</strong>
</span>
</p>
</content>
<has-media>Yes</has-media>
<media>
<media-type>Image</media-type>
<image type="file">
<content />
<path>/images/sig_placeholder.png</path>
<link>site://WDG F1 - Velocity/images/sig_placeholder.png</link>
<site>WDG F1 - Velocity</site>
<name>sig_placeholder.png</name>
</image>
<alt-tag>Picture alt tag</alt-tag>
<image-options>
<value>Caption</value>
<value>Credit</value>
</image-options>
<caption>image caption</caption>
<credit>image credit</credit>
<type-of-video>YouTube</type-of-video>
<video_id />
<alignment>Left</alignment>
<width>75%</width>
</media>
</text>
</page-element>
</system-data-structure>
XSL:
#macro(page_element $local_block)
#set ($content_type = $local_block.getStructuredDataNode("page-element/content-type").textValue)
#if ($content_type == "Text (w/ Supporting Media)")
#default_text($local_block)
#end
#end
#macro (default_text $local_block)
#set ($image_path = $local_block.getStructuredDataNode("page-element/text/media/image/path").textValue)
#end
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Ryan Griffith on 17 Feb, 2015 07:42 PM
Hi,
It looks as though you are mixing a little bit of XPath with the Locator Tool. Specifically, when using
getStructuredDataNode
you want to check to see if there is a chosen asset, then use the chooser asset's path.When you have a moment, give the following a try and let me know how it works out:
Please let me know if you have any questions.
Thanks!
Ryan Griffith closed this discussion on 05 Mar, 2015 07:41 PM.