Copied to clipboard

Flag this post as spam?

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


  • mvkamalesh 7 posts 27 karma points
    Jun 12, 2012 @ 08:58
    mvkamalesh
    0

    Display Node Based on Language

    I have one site with English and arabic in asp.net . I done it using umbraco . It working fine. But the problem is when i click on the image of arabic page it going to english decription page. I want to redirect it in to arabic of decription page. based up on the language selection it go it corresponding page. Please help me to sort it out. I know it is problem in my XSLT.

    In my template

    I have one macro included

    This is included in the settings / template

    <umbraco:Macro source="[#pageID]" Alias="ListCarouselBlocks" runat="server"></umbraco:Macro>

     

    #pageID should print the id for example the page is research its id is 1077 this page is in 2 nodes /en node and /ar node.

    xslt

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

    <xsl:template match="/">

    <!-- The fun starts here -->

    <ul>

    <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']">

    <li><a href="{umbraco.library:NiceUrl(@id)}">

    <img height="156" width="220">

    <xsl:attribute name="src"><xsl:value-of select="carouselImage"/></xsl:attribute>

    </img>

    </a></li>

    </xsl:for-each>

    </ul>

    </xsl:template>

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Jun 12, 2012 @ 10:02
    Alex Skrypnyk
    0

    Hi,

    If You want to work with different languages, you shouldn't use ID of pages, your way is using relative path to pages of current language.

  • mvkamalesh 7 posts 27 karma points
    Jun 12, 2012 @ 10:09
    mvkamalesh
    0

    Hi Alex thanks for your reply, 

     

    It works well if I pass node id directly but when language changes it does not work.

    <umbraco:Macro source="1077" Alias="ListCarouselBlocks" runat="server"></umbraco:Macro> (English Node ID 1077)

    else if arabic page

    <umbraco:Macro source="1650" Alias="ListCarouselBlocks" runat="server"></umbraco:Macro> (Arabic Node ID 1650)

    i have one template only.. i want to pass the source="" according to language

    thanks

     

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Jun 12, 2012 @ 16:21
    Alex Skrypnyk
    0

    Hi,

    You could write xpath relative to home node,something like that:

    <xsl:for-each select="$currentPage/ancestor-or-self::*[parent::root]/*[@nodeType = '1082']">

    in this case you get node from your language home page

    thanks,

    Alex

Please Sign in or register to post replies

Write your reply to:

Draft