Copied to clipboard

Flag this post as spam?

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


  • Daniel Dawson 27 posts 47 karma points
    Jul 09, 2011 @ 17:22
    Daniel Dawson
    0

    Image title and alt text not showing

    Hi guys,

    How would I get to display the image title and alt text for umbracoFile and umbracoFile1 (both upload datatypes)? It's been coded this way because umbracoFile1 is not always needed. This is for my gallery of logo's I've created and this XSLT will be used to show an individual logo (umbracoFile) and a business card/poster/flyer (umbracoFile1) so the alt and title text can be the same as the logo and business card relate to the same subject. 

    This is my current XSLT code:

    <?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" xmlns:umbraco.contour="urn:umbraco.contour" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary" 
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets umbraco.contour tagsLib BlogLibrary ">

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

    <xsl:param name="currentPage"/>
        

    <xsl:variable name="Width" select="460" />
    <xsl:variable name="Height" select="auto" />
        
    <xsl:template match="/">
            <xsl:apply-templates select="$currentPage/umbracoFile[normalize-space()]" />
            <xsl:apply-templates select="$currentPage/umbracoFile1[normalize-space()]" />
    </xsl:template>

        <xsl:template match="umbracoFile | umbracoFile1">
            <div class="portfolio-container">
          <img src="/imageGen.ashx?image={umbraco.library:UrlEncode(.)}&amp;width={$Width}&amp;
          height={$Height}" alt="{@nodeName}" title="{@nodeName}"/>
            </div>
    </xsl:template>

    </xsl:stylesheet>

    Thanks,

    Daniel

  • Kim Andersen 1447 posts 2197 karma points MVP
    Jul 09, 2011 @ 17:29
    Kim Andersen
    0

    Hi Daniel

    In your case, the only node name you have access to is the name of the current page. If this is the name you want to use your need to change the content in the two attributes to:

    {$currentPage/@nodeName}

    When you are using the upload data type, the images are not getting a node name if this was what you wanted to use.

    /Kim A

  • Daniel Dawson 27 posts 47 karma points
    Jul 09, 2011 @ 17:34
    Daniel Dawson
    0

    It works! Thanks a lot Kim thats exactly what I needed!

  • Kim Andersen 1447 posts 2197 karma points MVP
    Jul 09, 2011 @ 21:00
    Kim Andersen
    0

    You're welcome Daniel. I'm glad this was what you wanted to achieve :)

    /Kim A

Please Sign in or register to post replies

Write your reply to:

Draft