Copied to clipboard

Flag this post as spam?

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


  • niccolo rossi 33 posts 53 karma points
    Nov 24, 2011 @ 17:23
    niccolo rossi
    0

    select from two xmlnode

    Hi all,

    in a macro i have this variable

      <xsl:variable name="speciali"  select="umbraco.library:GetXmlNodeById(1446)/SpecialiArticle
                [string(visibileInHomePage) = '1' and string(codicePubblicazione) =$currentPage/codicePubblicazione]" />

    now i need to seek also in another id node but whit the same condiction. 

      <xsl:variable name="speciali2"  select="umbraco.library:GetXmlNodeById(1999)/SpecialiArticle
                [string(visibileInHomePage) = '1' and string(codicePubblicazione) =$currentPage/codicePubblicazione]" />

    it's possible to merge the result of the two select so i can have just one    <xsl:for-each select="$speciali">

         ......

    thank you 

    nico


  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 24, 2011 @ 20:27
    Jan Skovgaard
    0

    Hi Niccolo

    Could you perhaps post the whole XSLT code and perhaps explain a bit about what you're trying to achieve? I'm thinking we might be able to do the above thing in a more easy way perhaps.

    /Jan

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Nov 24, 2011 @ 21:59
    Chriztian Steinmeier
    0

    Hi Niccolo,

    You can do either of these:

    With your variables created you can do:

    <xsl:for-each select="$speciali | $speciali2">
        <!-- Do stuff -->
    </xsl:for-each>

    Otherwise, if you want to get rid of the duplication (and calling extension functions), try this:

    <xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::*[@level = 1]" />
    <xsl:variable name="speciali" select="$siteRoot//*[@id = 1446 or @id = 1999]/SpecialiArticle[visibileInHomePage = 1][codicePubblicazione = $currentPage/codicePubblicazione]" />
    
    <xsl:for-each select="$speciali">
        <!-- Do stuff -->
    </xsl:for-each>

    /Chriztian

Please Sign in or register to post replies

Write your reply to:

Draft