Search

hello. So i am having trouble getting this done. I have a list of projects and some of them have a link to a different website. but not all have this link.

<li><a href="{link-to-site}" class="projectlink"><xsl:value-of select="link-to-                 site"/></a></li>

thats how i have it but now each project has a black little button even thou it has no link…

Is there some XSLT code that i can do like the IF…if it has a link then had it to the list?

thanks

Yep.

The more declarative way to do it would be with XPath, making one template that matches on projects with a link , and another that matches on projects without:

   <xsl:template match="projects/entry/link/text() !=''">
        <!-- make li including a link-->
    </xsl:template>

    <xsl:template match="projects/entry/link/text() =''">
        <!-- make li with no link-->
    </xsl:template>

You have to test for content of the element, b/c Symphony will output a blank element for your ‘link’ field.

nm i got it….

<xsl:if test="link-to-site">
    <li><a href="{link-to-site}" class="projectlink"><xsl:value-of select="link-to-site"/></a></li>
</xsl:if>

i used that.

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