<!-- check if the 'media picker' property has a value --> <xsl:if test="data[@alias='excommknap'] != ''"> <!-- get the media XML and assign it to a variable --> <xsl:variable name="media" select="umbraco.library:GetMedia(number(data[@alias='excommknap']), 0)" /> <!-- check if the media XML contains an image path 'umbracoFile' --> <xsl:if test="count($media/data[@alias='umbracoFile']) > 0"> <a href="{umbraco.library:NiceUrl(@id)}">
<!-- Input the documenttype you want here --> <xsl:variable name="level" select="1"/>
<xsl:template match="/">
<!-- The fun starts here -->
<xsl:for-each select="$currentPage/ancestor-or-self::node [@level=$level]/node [string(data [@alias='umbracoNaviHide']) != '1']"> <!-- check if the 'media picker' property has a value --> <xsl:if test="data[@alias='excommknap'] != ''"> <!-- get the media XML and assign it to a variable --> <xsl:variable name="media" select="umbraco.library:GetMedia(number(data[@alias='excommknap']), 0)" /> <!-- check if the media XML contains an image path 'umbracoFile' --> <xsl:if test="count($media/data[@alias='umbracoFile']) > 0"> <a href="{umbraco.library:NiceUrl(@id)}">
Mouseover Img - using mediepicked content pictures.
Hello - newbie here.
i got a content page that has a property that shows that pages link img
i wanna add a secondary property that will be a alternate img for a mouseover effect over the link.
I got this here macro that i got working to show the first individual img. now im trying to figure out how to get a onmouseover onmouseroff on this.
<xsl:for-each select="$currentPage/ancestor-or-self::node [@level=$level]/node [string(data [@alias='umbracoNaviHide']) != '1']">
<!-- check if the 'media picker' property has a value -->
<xsl:if test="data[@alias='excommknap'] != ''">
<!-- get the media XML and assign it to a variable -->
<xsl:variable name="media" select="umbraco.library:GetMedia(number(data[@alias='excommknap']), 0)" />
<!-- check if the media XML contains an image path 'umbracoFile' -->
<xsl:if test="count($media/data[@alias='umbracoFile']) > 0">
<a href="{umbraco.library:NiceUrl(@id)}">
<img class="ExcommKnap" src="{$media/data[@alias='umbracoFile']}" border="0" />
</a>
</xsl:if>
</xsl:if>
</xsl:for-each>
but i would like to do this here in the <a href></a>
<img class="ExcommKnap" border="0"
onmouseover="this.src='{$media/data[@alias='umbracoFile']}'; this.alt='On alternate text';"
onmouseout="src='{$media/data[@alias='umbracoFile']}'; this.alt='On alternate text';" />
but i dont know how to pull two properties out and assign them individuelly to each of the mouse over/out
was thinking i could add a secondary variable and name it soemthing else - but then umbraco shows error code.
anyone got a solution / or / a better way of doing this id be happy :D
ack i posted wrong this is what i use and got working
.
<?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"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets umbraco.contour ">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>
<!-- Input the documenttype you want here -->
<xsl:variable name="level" select="1"/>
<xsl:template match="/">
<!-- The fun starts here -->
<xsl:for-each select="$currentPage/ancestor-or-self::node [@level=$level]/node [string(data [@alias='umbracoNaviHide']) != '1']">
<!-- check if the 'media picker' property has a value -->
<xsl:if test="data[@alias='excommknap'] != ''">
<!-- get the media XML and assign it to a variable -->
<xsl:variable name="media" select="umbraco.library:GetMedia(number(data[@alias='excommknap']), 0)" />
<!-- check if the media XML contains an image path 'umbracoFile' -->
<xsl:if test="count($media/data[@alias='umbracoFile']) > 0">
<a href="{umbraco.library:NiceUrl(@id)}">
<img class="ExcommKnap" src="{$media/data[@alias='umbracoFile']}" border="0" />
</a>
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
<a href="{umbraco.library:NiceUrl(@id)}">
<img class="ExcommKnap" border="0"
onmouseover="this.src='{$media/data[@alias='umbracoFile']}';this.alt='On alternate text';"
onmouseout="this.src=' SECONDARY VARIAbLE HERE ';this.alt='Off alternate text';"/>
</a>
this works to the extend of it showing a empty picture on mouseout - i just need to make a secondary variable and get that into the onmouseout.
is working on a reply...