Copied to clipboard

Flag this post as spam?

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


  • Sam 63 posts 126 karma points
    Dec 08, 2011 @ 08:26
    Sam
    0

    Call a specific doctype field

    Hi all , i have a site with the structure below

    default
      page 1
      page 2

    Slideshow
      Slide 1
      Slide 2  etc..

    On the default page I have a slideshow of images call from a macro with a source parameter (actually the Slideshow folder)

    In each slides a have a field with alias ="palette".

    I have to add a macro on my homepage that can acces this field .... i have witten something like this :

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet 
      version="1.0" 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" 
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

    <!-- start writing XSLT -->
      <xsl:for-each select="$currentPage/slide">
    <xsl:if test="palette!=''">

      <xsl:element name="li">
                  <xsl:attribute name="class"><xsl:text>dropEn </xsl:text><xsl:value-of select="palette"/></xsl:attribute>
      <href="/fr/" style="border:none;">Français</a>
        
      </xsl:element
      
      
      
     
    </xsl:if>

      
    </xsl:for-each>
      

    </xsl:template>

    </xsl:stylesheet>

     

    but this does not seem to be to correct...as it renders nothing.

    Any help on this please?

     

    //Sam

     

     

     

  • Markus Johansson 1936 posts 5864 karma points MVP 2x c-trib
    Dec 08, 2011 @ 08:33
    Markus Johansson
    0

    Hi Sam!

    Nice that you have found your way to Umbraco! Witch version are your running? If you are on 4.7 < I would strongly recomend you to skip the XSLT-learing and go with Razor-macros insted.

    But looking at your problem.

    <xsl:for-each select="$currentPage/slide">

    maybe should have the name of the "slideshow" node:

    <xsl:for-each select="$currentPage/slideshow/slide">


    Why are you using the alias='pallete'? You should be fine without that generic property.

  • Sam 63 posts 126 karma points
    Dec 08, 2011 @ 08:59
    Sam
    0

    Nope still dont render anything...i've tried using another macro with a source variable :

    <xsl:param name="currentPage"/>
    <xsl:variable name="source" select="/macro/source"/>
    <xsl:template match="/">

    <!-- start writing XSLT -->
      
       <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']">
    <xsl:if test="palette!=''">
      <xsl:element name="li">
                  <xsl:attribute name="class"><xsl:text>dropEn </xsl:text><xsl:value-of select="palette"/></xsl:attribute>
      <href="/fr/" style="border:none;">Français</a>    
      </xsl:element

      </xsl:if
    </xsl:for-each>
      

    </xsl:template>

     

    It renders ok but renders all li's under one drop down...each slide must have one drop down..

    You can view the site to more grasp the problem : www.luxislandresorts.com  .

    the editor can choose a palette for each photo slide to change the bg menu color etc...but now he want to change the top

    menu also which include a drop down...and thats why i want to cahnge color of drop down by calling the palette attribute.

    clear enough?

Please Sign in or register to post replies

Write your reply to:

Draft