xml formatting issue

William White's Avatar

William White

16 Jul, 2015 01:01 AM

I have the following data definition:

<system-data-structure>
    <asset type="page" identifier="redirectpage" label="Redirect Page"/>
    <asset type="file" identifier="redirectfile" label="Redirect File"/>
    <text type="checkbox" identifier="openinnewwindow" label="Open in new
window?">
        <checkbox-item value="Yes"/>
    </text>
</system-data-structure>

The following format:

#set ($page = $_XPathTool.selectSingleNode($contentRoot, "/system-index-block/calling-page/system-page"))
#set ($data = $page.getChild("system-data-structure"))

#set ($redirect_page_url = $_XPathTool.selectSingleNode($data, "redirectpage").getChild("link").value)
#set ($redirect_file_url = $_XPathTool.selectSingleNode($data, "redirectfile").getChild("link").value)
#set ($open_in_new_window = $_XPathTool.selectSingleNode($data, "openinnewwindow").value)

#if($redirect_page_url.length() > 2)
    #set ($redirect_url = $redirect_page_url)
#elseif ($redirect_file_url.length() > 2)
    #set ($redirect_url = $redirect_file_url)
#end

#if($open_in_new_window == "Yes")
    <meta http-equiv='Refresh' content='0;URL=[system-asset]${redirect_url}[/system-asset]' target='_blank' />
#else
    <meta http-equiv='Refresh' content='0;URL=[system-asset]${redirect_url}[/system-asset]' />
#end

Whether I check the checkbox or not I always get the else option. What am
I missing?

Thanks
Bill

  1. 1 Posted by Ryan Griffith on 16 Jul, 2015 11:36 AM

    Ryan Griffith's Avatar

    Hi Bill,

    If you take a look at the XML that is generated by that Data Definition, you will notice there is an additional <value> element that holds the value of the checkbox.

    When you have a moment, try adjusting the line that sets $open_in_new_window to the following:

    #set ($open_in_new_window = $_XPathTool.selectSingleNode($data, "openinnewwindow/value").value)
    

    Please let me know if you have any questions.

    Thanks!

  2. 2 Posted by William White on 17 Jul, 2015 03:14 AM

    William White's Avatar

    Ryan,

    Thanks. I accidentally deleted the value you pointed out. It didn't
    completely resolve the problem but I did get it resolved.

    Thanks for your help!
    Bill

  3. 3 Posted by Ryan Griffith on 17 Jul, 2015 12:07 PM

    Ryan Griffith's Avatar

    Thank you for following up, Bill, I am glad to hear you were able to resolve the issue.

    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.

    Have a great day!

  4. Ryan Griffith closed this discussion on 17 Jul, 2015 12:07 PM.

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

 

26 Aug, 2016 01:19 PM
25 Aug, 2016 03:02 PM
25 Aug, 2016 12:50 PM
24 Aug, 2016 08:43 PM
24 Aug, 2016 07:20 PM
21 Aug, 2016 01:20 PM