Copied to clipboard

Flag this post as spam?

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


  • Connie DeCinko 931 posts 1160 karma points
    Apr 05, 2016 @ 23:14
    Connie DeCinko
    0

    Filter by value in checkboxlist in XSLT

    In my XSLT, I am getting all children of my slideshow root via

    <xsl:for-each select="umbraco.library:GetXmlNodeById(1157)/* [name() = 'HeaderSlideshow' and @isDoc]">
    

    but now I want to filter further by checking to see if a certain item is selected in the node's checkboxlist. I want to do something like this but it's not right. Worst case, I have to add an IF check for each node.

    <xsl:for-each select="umbraco.library:GetXmlNodeById(1157)/* [name() = 'HeaderSlideshow' and @isDoc and @slidePlacement contains ('160')]">
    
  • Connie DeCinko 931 posts 1160 karma points
    Apr 05, 2016 @ 23:52
    Connie DeCinko
    0

    Ok, I got it to work, but now I want to streamline my code and pass a variable instead of having three nearly identical sections.

    So this works:

    <xsl:for-each select="umbraco.library:GetXmlNodeById(1157)/* [name()='HeaderSlideshow' and contains(slidePlacement, 'Home Page') and @isDoc]">
    

    But this does not:

    <xsl:variable name="targetPage" select="/macro/targetPage"/>
    

    ...

    <xsl:for-each select="umbraco.library:GetXmlNodeById(1157)/* [name()='HeaderSlideshow' and contains(slidePlacement, $targetPage + ' Page') and @isDoc]">
    

    How can I use the $targetPage variable?

Please Sign in or register to post replies

Write your reply to:

Draft