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.
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.
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 " "> ]>
<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(.)}&width={$Width}&
height={$Height}" alt="{@nodeName}" title="{@nodeName}"/>
</div>
</xsl:template>
</xsl:stylesheet>
Thanks,
Daniel
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:
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
It works! Thanks a lot Kim thats exactly what I needed!
You're welcome Daniel. I'm glad this was what you wanted to achieve :)
/Kim A
is working on a reply...