Search

Hello,

I'm currently using a choose when command to take the visitor to a master template based on the URL they have inputted, for example:

<xsl:template match="/">
<xsl:choose>
<xsl:when test="$root = 'http://mysite.com'">
<xsl:call-template name="site1"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="site2"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template name="site1"> <!-- Example -->
<html lang="en">
<head></head>
<body>
<xsl:apply-templates select="data/navigation/page[types/type ='site1']"/>
<xsl:apply-templates/>
</body>
</xsl:template>

<xsl:template name="site2"> <!-- Example -->
<html lang="en">
<head></head>
<body>
<xsl:apply-templates select="data/navigation/page[types/type ='site2']"/>
<xsl:apply-templates/>
</body>
</xsl:template>

This setup is currently working fine apart from the <xsl:apply-templates/> script is bringing in all pages, is there a way I can filter which pages the master templates bring in based on the page type names similar to how I’m using the nav script.

Many Thanks.

with templates you are allowed to use modes so you can do

<xsl:apply-templates mode='site1'/>

and each template has to specify mode='site1' then only those templates of the same mode will run.

Fantastic, thanks for the reply gunglien.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details