It might be because your include and master XSLT file both include the same template (<xsl:template match="/">) - you should probably remove this from your included XSLT and create a template you can call by name or match condition.
You can only include (or import) at the root level, so you can't put the <xsl:include> instruction inside another template.
Effectively the templates from the included file gets inserted where you put the include instruction, so you need to be careful with duplicated templates. But you can use it for great things - read the article Tom linked to (thanks Tom!) for further goodies.
Actually i would like to have a loop in my slideshow XSLT which will loop in the media folder. So at the moment I need to add the include somewhere in the main xslt.
To put you more in the figure, the main xslt consists of several tabs which by default has a display:none; . In one of them it has been asked by the client to fetch for images in the media folder. Thats the reason why I want to make use of <xsl:include href="" />, but not sure of how to achieve this.
Yes I got this part working, now i need to get the page to display the images from my media section. However this is quiet tricky since i need to check if a node is related to sepcific media id under my media section.
Got it sorted out !!!!! So basically i have my main xslt and include in it where the include will look for its slideshow gallery and will loop through it to get all the images.
But thanks again for the help on how to make the include working Tom.
Include XSLT within another XSLT
Hi Guys,
Am trying to get include a XSLT withing another one but getting some error message. I tried some previous post but still cant get it working.
This is my main XSLT
<xsl:param name="currentPage"/>
<xsl:include href="slideshow.xslt"/>
<xsl:template match="/">
<!-- start writing XSLT -->
<xsl:for-each select="$currentPage">
<div class="content">
<h2 class="acc_trigger"><a href="#">Introduction</a></h2>
<div class="acc_container">
<div class="block">
<xsl:value-of select="member_Introduction" disable-output-escaping="yes"/>
</div>
</div>
<h2 class="acc_trigger"><a href="#">Slideshow</a></h2>
<div class="acc_container">
<div class="block">
<!-- <xsl:include href="slideshow.xslt"/> -->
</div>
</div>
</div><!-- End of Content -->
</xsl:for-each>
</xsl:template>
And my Include XSLT Slideshow
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
<xsl:template match="/">
<!-- start writing XSLT -->
Hello World there!!!
</xsl:template>
</xsl:stylesheet>
Whenever i want to move my include xslt in between the slideshow container i get an error message and everything just crash.
Anyone can point be to the right direction??
Hey Fuji,
It might be because your include and master XSLT file both include the same template (<xsl:template match="/">) - you should probably remove this from your included XSLT and create a template you can call by name or match condition.
Check out this article on Chriztian's blog for some examples: <xsl:include> or <xsl:import> ?
-Tom
Hi Fuji,
You can only include (or import) at the root level, so you can't put the <xsl:include> instruction inside another template.
Effectively the templates from the included file gets inserted where you put the include instruction, so you need to be careful with duplicated templates. But you can use it for great things - read the article Tom linked to (thanks Tom!) for further goodies.
/Chriztian
Hi Guys,
I tried your blog as suggested by Tom. But still not getting the output. This is how i proceed.
Main XSLT
And Include Slideshow XSLT
I just want the Text to appear in the first place then i will carry on this the functionality of the slideshow xslt. Any advise on this guys??
//fuji
Ive been struggling to get this working but seems like am missing something there....still cant get any output
Hi Fuji,
I would suspect your match="test" template isn't getting called. What exactly is $currentPage/test? Is there a property called test?
Not sure your exact situation, but if you are wanting to list Images from a Media Folder, you could try something like:
Replacing 0000 with the ID of the Media Folder (or a variable containing it).
-Tom
Hi Tom,
Actually i would like to have a loop in my slideshow XSLT which will loop in the media folder. So at the moment I need to add the include somewhere in the main xslt.
To put you more in the figure, the main xslt consists of several tabs which by default has a display:none; . In one of them it has been asked by the client to fetch for images in the media folder. Thats the reason why I want to make use of <xsl:include href="" />, but not sure of how to achieve this.
//fuji
What I posted above should work then, just replace 0000 with the media folder ID or property containing it
It should then call your template in the include file for each Image that is found in the folder
-Tom
Could you not include the other stylesheet as a macro?
Hi Tom,
Yes I got this part working, now i need to get the page to display the images from my media section. However this is quiet tricky since i need to check if a node is related to sepcific media id under my media section.
Am not sure if you are getting my point though.
//fuji
Hmm, not sure I follow, what do you mean by if a node is related to a media ID?
Got it sorted out !!!!! So basically i have my main xslt and include in it where the include will look for its slideshow gallery and will loop through it to get all the images.
But thanks again for the help on how to make the include working Tom.
//fuji
is working on a reply...