Search

On the users first time into the site or whenever going to "Home". (otherwise reaching home.xsl) I want to show something very custom and it is working this far until I try and work with applying a specific navigation template.

So I have in navigation.xsl: http://pastie.org/3678823

in Home.xsl I wanted to do: http://pastie.org/3678829

Basically for "home" apply-template data/navigation/homepage so that I get my custom navigation just how I want it and then for the other ages on the site apply a different navigation that is at the top of the site.

But I dont see this show up when getting to home.xsl. So For some reason the data/navigation/homepage template is not applying.

What am I missing. I thought that I could surely do what I am wanting and create custom template to apply, etc.

Can anyone provide some advice?

<xsl:template match="data">
    ...
    <xsl:apply-templates select="data/navigation/homepage"/>  
</xsl:template>

That Xpath expression in home.xsl is relative to the context node so basically you're trying to select a node that doesn't exist: /data/data/navigation/homepage

but even 'navigation/homepage' or '/navigation/homepage/' doesn't show it either.

What does the output of ?debug look like for one of the pages you want to apply this to?

navigation/homepage would be correct. Have you attached the navigation data-source to the Home page?

Hi Tony,

It looks like this: http://pastie.org/3700749

Navigation has been attached.

-Jason

Hi Jase — here's my revised versions of your XSL templates: https://gist.github.com/6129fa3ce7ca15dfb35e

Basically, you were doing:

<xsl:template match="navigation/homepage">…</xsl:template>

When you should have been using:

<xsl:template match="homepage">…</xsl:template>

updated: http://pastie.org/3701340

I still done see the custom navigation when home.xsl is rendered.

There appears to be a major flaw in your entire concept: You seem to be mistaking select and match expression with template names:

<xsl:apply-templates select="navigation/homepage"/>

and

<xsl:template match="homepage">
  ...
</xsl:template>

Will only work if there is a node <homepage> in your XML:

<data>
   ...
   <navigation>
      <homepage>
         ...
      </homepage>
   </navigation>
</data>

But the Navigation datasource only returns <page> nodes.

It appears you want to work on those regular nodes but design them in a special way when you're on the homepage. To achieve this you have to fix

<xsl:template match="homepage">
  <div style="position:relative; top:-450px; left:975px;" class="rounded_box">
    <xsl:apply-templates select="page[@handle='home']" />
  </div>
  <div style="position:relative; top:-350px; left:975px;" class="rounded_box">
    <xsl:apply-templates select="page[@handle='blog']" />
  </div>
  <div style="position:relative; top:-250px; left:975px;" class="rounded_box">
    <xsl:apply-templates select="page[@handle='about']" />
    </div>
</xsl:template>

Make it match the actual rootnode of your Navigation DS: navigation instead of homepage. You will end up with two contradicting templates: One for the regular style, one for the homepage style.

To make the homepage style override the regular one, but only on the homepage you have to remove it from navigation.xsl and put it into home.xsl. The reason: All templates in any of your files take precedence over templates being included using the <xsl:import /> instruction.

So every time you need to change a specific bit of one of your utilities you can override them at will in your pages.

phoque, this was solid advice. Thank you. Your advice and going through a portion of the tutorials again help me out a lot.

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