Another Passthrough question

Greg Gomez's Avatar

Greg Gomez

19 Aug, 2015 10:20 PM

Hello:

I've got some XSL that contains this:

    <xsl:template match="/">
        <xsl:comment>#protect-top</xsl:comment>
        <xsl:apply-templates select="system-data-structure"/>
        <xsl:comment>#protect-top</xsl:comment>
    </xsl:template>
To transform to JSON.

The transform works fine in oXygen as well as when I test it in Cascade's editor. Here's what it displays:

<!--#protect-top-->{"system-data-structure":{...}}
<!--#protect-top-->

However, when I Preview a page that has the format applied, I get the following error:
An error occurred: Root element not set

I get a similar error in publish messages when I publish.

All pages that have this format use this template:

<!--#cascade-skip--><system-region name="DEFAULT"/><!--#cascade-skip-->

I've tried a number of things, including removing the cascade-skip from the template, and using protected in the format. So far, nothing has worked.

Any ideas?

Thanks!
Greg

  1. 1 Posted by Ryan Griffith on 20 Aug, 2015 11:37 AM

    Ryan Griffith's Avatar

    Hi Greg,

    It looks like you are very close, but your Template needs a little tweaking. Specifically, you still need a root node that surrounds your DEFAULT region to ensure it's valid XML.

    When you have a moment, try changing your Template to the following:

    <!--#cascade-skip--><pass-through><system-region name="DEFAULT"/></pass-through>
    

    To summarize, the <pass-through> element within the Template will allow you to work around the "root node" requirement for valid XML, and the #cascade-skip will remove that element on render. The #protect-top within your Format will move your content to the very top, resulting in a plain text file being generated.

    Please let me know if you have any questions.

    Thanks!

  2. 2 Posted by Greg Gomez on 21 Aug, 2015 08:49 PM

    Greg Gomez's Avatar

    Hi, Ryan:

    Yeah, that did it.

    Thanks!
    Greg

  3. 3 Posted by Ryan Griffith on 24 Aug, 2015 12:50 PM

    Ryan Griffith's Avatar

    Thank you for following up, Greg, I am glad to hear the adjustment did the trick.

    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 24 Aug, 2015 12:50 PM.

Comments are currently closed for this discussion. You can start a new one.

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