master.xsl template
This is an open discussion with 2 replies, filed under XSLT.
Search
You’ll need to modify the master.xsl template to accommodate the feature or use a different template for the page the requires this feature. Otherwise, you can implement some conditional logic using xsl:choose or xsl:if instructions to display the slider given the existence of a particular URL parameter or a certain value for a page parameter.
In your master where you want the slider to appear:
<xsl:apply-templates select="data" mode="slider"/>
In your page where you want the slider to appear, match on data
with the mode of slider
:
<xsl:template match="data" mode="slider"> .... </xsl:template>
Ideally page-specific features wouldn’t be referenced in the master, since you’re spreading page content throughout multiple files. But it”s often unavoidable — it depends on the design/layout requirement.
If the slider sits within a block in the layout that is used for other content as well (perhaps a slider on one page, an image carousel on another, an embedded video on another) you could use the above template but give it a mode
name of something like “rich-content” to make it more generic. Within each page, in addition to the normal template match you already have, you also have the above template matching data with the “rich-content” mode. This gives you two areas into which you can inject content to the master.
More here: http://chaoticpattern.com/article/overriding-templates/
Create an account or sign in to comment.
Hi,
I’m working with symphony to make a political site. In my master.xsl file, the <xsl:apply-templates/> tag calls the articles and displays them on the home page. However, in the same file, but further up the page, I’d like to show a dynamic slider pulling info from the articles section. I’ve got all the data sources and such set, but how can I call a certain template from master.xsl outside of the area specified with the apply-templates tag?