XSLT Include
Hi I'm currently trying to include another xslt stylesheet and I always get the error:
"An error occurred while rendering asset preview: javax.xml.transform.TransformerException: org.jdom.JDOMException: Exception in startElement: Had IO Exception with stylesheet file: write-pod"
original.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:include href="write-pod" />
<xsl:template match="system-index-block">
<xsl:apply-templates select="calling-page/system-page/system-data-structure"/>
</xsl:template>
<xsl:template match="system-data-structure">
<div class="slab" id="forwardtogether" style="padding:1.5rem 0">
<div class="row">
<div class="columns small-12 text-center">
<picture>
<source alt="Forward Together" media="(min-width: 701px)" srcset="img/homepage/forward/forwardtogether_logo_crop.png"/>
<source media="(max-width: 700px)" srcset="img/homepage/forward/forwardtogether_logo_home_vert_crop.png"/>
<img alt="forward together" height="168" src="img/homepage/forward/forwardtogether_logo_home_vert_crop.png" width="1072"/>
</picture>
</div>
<div class="clearfix"></div>
<!-- MODALS SECTION -->
<div class="modals">
<xsl:call-template name="write-modal">
<xsl:with-param name="type">
<xsl:text>preparing</xsl:text>
</xsl:with-param>
<xsl:with-param name="level">
<xsl:text>1</xsl:text>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="write-modal">
<xsl:with-param name="type">
<xsl:text>building</xsl:text>
</xsl:with-param>
<xsl:with-param name="level">
<xsl:text>2</xsl:text>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="write-modal">
<xsl:with-param name="type">
<xsl:text>solving</xsl:text>
</xsl:with-param>
<xsl:with-param name="level">
<xsl:text>3</xsl:text>
</xsl:with-param>
</xsl:call-template>
</div>
</div>
</div>
</xsl:template>
<!-- WRITING THE MODAL CONTENT -->
<xsl:template name="write-modal">
<xsl:param name="type"/>
<xsl:param name="level"/>
<div aria-hidden="true" class="reveal-modal small" data-reveal="" id="{$type}" role="dialog">
<xsl:for-each select="pod">
<xsl:if test="position() = $level">
<p><xsl:text disable-output-escaping="yes">&nbsp;</xsl:text></p>
<div class="flex-video">
<iframe allowfullscreen="" frameborder="0" height="395" src="{video-url}" width="700"></iframe>
</div>
<div class="button-collapse-stack">
<div class="columns small-12 medium-6">
<a class="button expand hp-button hp-outline-button hp-outline-button1" href="{destination}">LEARN MORE</a>
</div>
<div class="columns small-12 medium-6">
<a class="button expand hp-button hp-fill-button hp-fill-button1" href="https://bastion.csusm.edu/giving/">GIVE NOW</a>
</div>
</div>
<a aria-label="Close" class="close-reveal-modal">×</a>
</xsl:if>
</xsl:for-each>
</div>
</xsl:template>
</xsl:stylesheet>
write-pod.xsl
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="system-data-structure">
<xsl:call-template name="write-pod">
<xsl:with-param name="type">
<xsl:text>preparing</xsl:text>
</xsl:with-param>
<xsl:with-param name="level">
<xsl:text>1</xsl:text>
</xsl:with-param>
</xsl:call-template>
<!-- END OF POD 1 -->
<xsl:call-template name="write-pod">
<xsl:with-param name="type">
<xsl:text>building</xsl:text>
</xsl:with-param>
<xsl:with-param name="level">
<xsl:text>2</xsl:text>
</xsl:with-param>
</xsl:call-template>
<!-- END OF POD 2 -->
<xsl:call-template name="write-pod">
<xsl:with-param name="type">
<xsl:text>solving</xsl:text>
</xsl:with-param>
<xsl:with-param name="level">
<xsl:text>3</xsl:text>
</xsl:with-param>
</xsl:call-template>
<!-- END OF POD 3 -->
</xsl:template>
<xsl:template name="write-pod">
<xsl:param name="type"/>
<xsl:param name="level"/>
<div class="small-12 large-4 columns">
<div class="hp-circle-block text-center">
<xsl:for-each select="pod">
<xsl:if test="position() = $level">
<xsl:element name="div">
<xsl:attribute name="class">
<xsl:value-of select="concat('forward-image second-effect ', $type)"/>
</xsl:attribute>
</xsl:element>
<p>
<a data-reveal-id="{$type}" href="#">
<img alt="{alt}" class="{$type}" height="350" src="{img/path}" width="350"/>
</a>
</p>
<div class="mask"></div>
<div class="content">
<a class="info" href="#">
<xsl:attribute name="data-reveal-id">
<xsl:value-of select="$type"/>
</xsl:attribute>
</a>
</div>
<div class="forward-text-container">
<div class="forward-text">
<xsl:value-of select="pod-quote"/>
<br/>
<span>
<xsl:value-of select="author"/>
</span>
</div>
<p>
<a class="button expand hp-button hp-fill-button hp-fill-button1" data-reveal-id="{$type}" href="{destination}">
<xsl:value-of select="button"/>
</a>
</p>
</div>
</xsl:if>
</xsl:for-each>
</div>
</div>
</xsl:template>
</xsl:stylesheet>
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 10 Jun, 2016 12:20 PM
Hi Maurice,
When you have a moment, please also attach sample XML you are applying to this Format so we can do some local testing.
Thanks!
2 Posted by Wing Ming Chan on 10 Jun, 2016 01:02 PM
Hi Maurice,
Two things:
2. You may want to introduce namespaces in your library code and the stylesheets using the library code1. You need to include the site name in the
xsl:include
element like this:Also a suggestion for Hannon Hill. Users should be taught on how to build and use library code: XSLT, Velocity, and web services.
Wing
3 Posted by Maurice on 13 Jun, 2016 04:11 PM
Hello Dr. Wing,
After i tried linking the xslt like what you said I got this error:
An error occurred while rendering asset preview: Had IO Exception with stylesheet file: csusm/_homeassets/site://_homeassets/write-pod
It looks like I do not have to include the site and just add the name of the XSLT.
4 Posted by Maurice on 13 Jun, 2016 04:13 PM
I attached the XML sample
Support Staff 5 Posted by Tim on 13 Jun, 2016 04:18 PM
Maurice,
This error:
generally means that the system can't find the stylesheet you're referencing. You need to make sure that you use the full path to that Format/stylesheet when you're writing that include statement. If the Format you're referencing is in another Site, you'll need to use the site notation as Wing mentioned.Can you provide a screen shot showing the location of this Format you're attempting to reference? Once we can determine which Site it is in along with the directory it's in, someone here can help you with that include statement.
6 Posted by Maurice on 13 Jun, 2016 04:31 PM
Hello Tim, I have the file in global and not in a site.
Support Staff 7 Posted by Tim on 13 Jun, 2016 04:40 PM
Thanks for the screen shot, Maurice. Is
and let me know if that allows you to save.write-pod
in the same Folder as thisforward
Block? If so, try changing your include to:8 Posted by Wing Ming Chan on 13 Jun, 2016 05:57 PM
Since Global is going away soon, why not move everything out of Global into a site?
Wing
Tim closed this discussion on 29 Jun, 2016 02:29 PM.