Copied to clipboard

Flag this post as spam?

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


  • chris cameron 36 posts 56 karma points
    Jan 23, 2012 @ 11:28
    chris cameron
    0

    two variables search

    Newbie so please bare with me, I have two varibles products and productscat. I which to display a product listing based upon a search filter. I can get a listing out for one by <xsl:for-each select="$products"> but how do I combine both variables so they both contribute to the listing, something like <xsl:for-each select="concat($products, $productscat)"> .. this doesn't work but along these lines?

  • Rodion Novoselov 694 posts 859 karma points
    Jan 23, 2012 @ 13:36
    Rodion Novoselov
    0

    Hi. If you want to pass these to variables to an XSLT macro neither have you to mix nor combine them in any way. Just declare two separate macro parameters for instance aliased "products" and "productCat" and pass them to a macro as parameters (e.g. <umbraco:macro runat="server" Alias="MyMacro" products="foo" productCat="bar"/>). Then inside your xslt you can access them separately with XPath:

    <xsl:variable name="products" select="/macro/products"/>
    <xsl:variable name="productCat" select="/macro/productCat"/>

     

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Jan 23, 2012 @ 19:06
    Chriztian Steinmeier
    0

    Hi Chris,

    To combine nodesets you use a pipe character (concat() is for strings only):

    <xsl:for-each select="$products | $productscat">
       ...
    </xsl:for-each>

    /Chriztian

  • chris cameron 36 posts 56 karma points
    Jan 23, 2012 @ 20:59
    chris cameron
    0

    Great Thanks Christian, applying that principle on another part of the code fixed the issue. cheers

Please Sign in or register to post replies

Write your reply to:

Draft