Search

How do we call two html snippets based on a variable check. I am using one datasource to call all entries from 'section' packages. Also same DS accepts a url parameter to display a single entry.

If '$entry' variable true, show this entry template or packages template.

Here is the code.

http://paste.laravel.com/q07

Thanks, Noushad.

@noussh - Try this, http://paste.laravel.com/q0H

@bzerangue,

what's the xslt tag to call utilities based on different scenario. I have imported two utilities,

<xsl:import href="../utilities/get-packages.xsl"/>
<xsl:import href="../utilities/get-package-entry.xsl"/>

<xsl:when test="$entry!=''">
                    how do i call a utility here
</xsl:when>

@noussh

you cannot actually call utilities according to scenarios what you can do is use modes, or different match strings, or call different template names below find the examples. Note that all templates will co-exist if you import them in different utilities. so you might have some overriding each other unless you use different names or modes.

<xsl:template match='/data/data-source/entry' mode='1'>
    do something
</xsl:template>

<xsl:template match='/data/data-source/entry' mode='2'>
    do something else
</xsl:template>

<xsl:template name='no-datasource'>
    case no match
</xsl:template>

<xsl:choose>
    <xsl:when test="$entry!=''">
        <xsl:apply-templates select='/data/data-source/entry' mode='1'/>
    </xsl:when>
    <xsl:otherwise>
        <xsl:call-template name='no-datasource'/>
    </xsl:otherwise>
</xsl:choose>

@ gunglien

Thank you for a clear explanation. It worked.

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