Search

Hi there,

this is my first post here, so: greetings! And, Symphony is great.
(this is not the right place for a bio, so let's get to the code)

I would like to ask: is there a way to override the value of a node?

For example, I have an utility called page-title.xsl (I'm using the html5 ensemble). Inside I have:

<xsl:template name="page-title">
    <xsl:value-of select="$page-title"/>

        <xsl:text> &#8212; </xsl:text>
        <xsl:value-of select="$website-name"/>

</xsl:template>

I know that the value of page-title is the value of a param node (it's in data/params/page-title. What is the right thing to do in order to override this value in my template (depending on the page)?

Thank you in advance.
Alberto

Hi Alberto and welcome,

I solve this by using a named template for page-title and call it as: <xsl:call-template name="page-title" />

This way I can override it per-Page by simply adding a <xsl:template name="page-title">…</xsl:template> in the specific Page template and add different content.

This works for me, but there are more ways to do this. You could also have a bunch of <xsl:choose>…<xsl:when/> statements :)

That was quick! Thank you. It worked like a charm.

Alberto

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