Search

I've the Login info-event attached to one of my pages. When I view the source for that rendered page, at the end I find the following data:

<!-- 
<events>
    <login-info logged-in="true" id="1" user-type="developer" primary-account="yes">
    <name>Anders Thoresson</name>
    <username>anders</username>
    <email>mail@address.com</email>
</login-info>
</events>
 -->

So far, so good. But then I add this code to one of the utilities to the page:

<xsl:if test="$is-logged-in = 'true'">
  <xsl:text> &#8212; </xsl:text>
  <a href="{$root}/symphony/publish/comments/?filter=article:{/data/blog/entry/@id}">Manage</a>
</xsl:if>

And suddenly I get an error message saying that $is-logged-in isn't registered. Why?

Check your params for $is-logged-in.

Otherwise, just change $is-logged-in to /data/events/login-info/@logged-in

You first need to declare the parameter before you can test it. First, give the parameter a value by declaring it at the beginning of your stylesheet or at the beginning of your template, depending on the scope desired for the parameter.

<xsl:template match="data">
    <xsl:param name="is-logged-in" select="/data/events/login-info/@logged-in"/>
    <xsl:param name="username" select="/data/events/login-info/username"/>
    <xsl:if test="$is-logged-in = 'true'">
        <xsl:text>You are currently logged in as </xsl:text>
        <xsl:value-of select="$username"/>
    </xsl:if>
</xsl:template>

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