Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Steve 472 posts 1216 karma points
    Nov 16, 2015 @ 15:50
    Steve
    0

    Quick XPath Explanation

    Could someone explain what this statement would be testing please?

    <xsl:if test="count($featuredArticles[@id=current()/@id])&lt;=0"> 
    
  • Chriztian Steinmeier 2732 posts 8341 karma points MVP 5x admin c-trib
    Nov 16, 2015 @ 22:03
    Chriztian Steinmeier
    0

    Hi Steve,

    It's a somewhat clumsy way of checking within a for-each loop, if the current node in the loop is present in the $featuredArticles selection. Probably because the original code was written (or conceived) in another language.

    This should do the same:

    <xsl:if test="$featuredArticles[@id=current()/@id]">
    

    Or even as simple as:

    <xsl:if test="@id = $featuredArticles/@id">
    

    /Chriztian

Please Sign in or register to post replies

Write your reply to:

Draft