As the title says, I'm receiving an error after using the thumbnail macro.
installed packages:
ImageGen 2.5.2
ThumbnailWithLightbox 1.0
After instelling the above packages, I'm adding a macro (Thumbnail) and selecting a image from the media folder. Butv after saving the content, I'm getting the "Error parsing XSLT file: \xslt\Thumbnail.xslt" error.
Is there a setting I forgot? or is the xslt buggy?:
Could you add "?umbDebugShowTrace=true" querystring to the URL of the page with the error? Once you've done that, scroll down until you see any red/error messages - hopefully this should give you a clue where the problem is.
If you can't figure it, post the error message, I'm sure we can help you resolve it.
Value was either too large or too small for an Int32. Value was either too large or too small for an Int32. at System.Convert.ToInt32(Double value) at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) at System.Xml.Xsl.Runtime.XmlQueryRuntime.ChangeTypeXsltArgument(XmlQueryType xmlType, Object value, Type destinationType) at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args) at System.Xml.Xsl.CompiledQuery.Query.<xsl:template match="/">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, Double {urn:schemas-microsoft-com:xslt-debug}position, Double {urn:schemas-microsoft-com:xslt-debug}last, IList`1 {urn:schemas-microsoft-com:xslt-debug}namespaces) in C:\inetpub\wwwroot\KK\xslt\Thumbnail.xslt:line 28 at System.Xml.Xsl.CompiledQuery.Query.<xsl:apply-templates>(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator , Double , Double ) at System.Xml.Xsl.CompiledQuery.Query.Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at System.Xml.Xsl.CompiledQuery.Query.Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer) at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results) at umbraco.macro.GetXsltTransformResult(XmlDocument macroXML, XslCompiledTransform xslt, Dictionary`2 parameters) at umbraco.macro.loadMacroXSLT(macro macro, MacroModel model, Hashtable pageElements)
The error ("Error parsing XSLT file: \xslt\Thumbnail.xslt") is both shown in the TinyMCE content editor as on the actual page. In the Macro I selected a image from the Media folder, put '150' in the thumbnail width textbox and ticked the Link and Lightbox tickboxes for 'yes'.
Maybe try changing your surrounding if statement from OR to AND to make sure there is an $imageid? Otherwise the GetMedia call will fail with the above error if there is no id passed
<xsl:if test="$thumbwidth != '' and $imageid != ''">
I tried both the above solutions and they generated the same output:
<div umb_macroalias="Thumbnail" umb_lightboxgroup="" umb_thumbwidth="100" umb_linktoorig="1"
umb_imageid="1151" umb_align="" umb_uselightbox="1" ismacro="true" onresizestart="return false;"
umbversionid="ddaea327-8ace-497e-91c5-6ff1c175fd3d" umbpageid="1183"
title="This is rendered content from macro" class="umbMacroHolder"></div>
But the output isn't being converted to an image. I tested the image directly using the following url:
~ImageGen.ashx?image=1151&width=100&constrain=true , but it gave an error: "File not found: 1151" I don't know how Umbraco and/or ImageGen.ashx are retrieving the image using the imageId, but it looks like thats the source of the problem.
The image with id '1151' is available in the Media folder and can be used by other macros.
Error parsing XSLT file: \xslt\Thumbnail.xslt (ImageGen + Thumbnail xslt)
As the title says, I'm receiving an error after using the thumbnail macro.
installed packages:
<!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"
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:param name="imageid" select="/macro/imageid/node/@id"/>
<xsl:param name="thumbwidth" select="/macro/thumbwidth"/>
<xsl:param name="align" select="/macro/align"/>
<xsl:param name="linktoorig" select="/macro/linktoorig"/>
<xsl:param name="uselightbox" select="/macro/uselightbox"/>
<xsl:param name="lightboxgroup" select="/macro/lightboxgroup"/>
<xsl:template match="/">
<xsl:if test="$thumbwidth != '' or $imageid != ''">
<xsl:choose>
<xsl:when test="$linktoorig = '1'">
<a>
<xsl:attribute name="title">
<xsl:value-of select="umbraco.library:GetMedia($imageid, 'false')/@nodeName"/>
</xsl:attribute>
<xsl:attribute name="href">
<xsl:value-of select="umbraco.library:GetMedia($imageid, 'false')/data [@alias = 'umbracoFile']"/>
</xsl:attribute>
<xsl:if test="$uselightbox = '1'">
<xsl:choose>
<xsl:when test="$lightboxgroup != ''">
<xsl:attribute name="rel">
<xsl:text>lightbox[</xsl:text><xsl:value-of select="$lightboxgroup"/><xsl:text>]</xsl:text>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="rel">
<xsl:text>lightbox</xsl:text>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose> <!-- lightboxgroup -->
</xsl:if> <!-- uselightbox-->
<xsl:call-template name="drawImage">
<xsl:with-param name="imageid" select="$imageid"/>
<xsl:with-param name="thumbwidth" select="$thumbwidth"/>
<xsl:with-param name="align" select="$align"/>
</xsl:call-template>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="drawImage">
<xsl:with-param name="imageid" select="$imageid"/>
<xsl:with-param name="thumbwidth" select="$thumbwidth"/>
<xsl:with-param name="align" select="$align"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose> <!-- linkToOrig -->
</xsl:if>
</xsl:template>
<xsl:template name="drawImage">
<xsl:param name="imageid"/>
<xsl:param name="thumbwidth" />
<xsl:param name="align" />
<img>
<xsl:attribute name="src">
<xsl:text>/umbraco/ImageGen.ashx?image=</xsl:text>
<xsl:value-of select="umbraco.library:GetMedia($imageid, 'false')/data [@alias = 'umbracoFile']"/>
<xsl:text>&width=</xsl:text>
<xsl:value-of select="$thumbwidth"/>
<xsl:text>&constrain=true</xsl:text>
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="umbraco.library:GetMedia($imageid, 'false')/@nodeName"/>
</xsl:attribute>
<xsl:if test="$align != ''">
<xsl:attribute name="align">
<xsl:value-of select="$align"/>
</xsl:attribute>
</xsl:if>
</img>
</xsl:template>
</xsl:stylesheet>
Hi Joel,
Could you add "?umbDebugShowTrace=true" querystring to the URL of the page with the error? Once you've done that, scroll down until you see any red/error messages - hopefully this should give you a clue where the problem is.
If you can't figure it, post the error message, I'm sure we can help you resolve it.
Cheers, Lee.
Hmm... its all abracadabra for me..
Value was either too large or too small for an Int32.
Value was either too large or too small for an Int32.
at System.Convert.ToInt32(Double value)
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at System.Xml.Xsl.Runtime.XmlQueryRuntime.ChangeTypeXsltArgument(XmlQueryType xmlType, Object value, Type destinationType)
at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args)
at System.Xml.Xsl.CompiledQuery.Query.<xsl:template match="/">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, Double {urn:schemas-microsoft-com:xslt-debug}position, Double {urn:schemas-microsoft-com:xslt-debug}last, IList`1 {urn:schemas-microsoft-com:xslt-debug}namespaces) in C:\inetpub\wwwroot\KK\xslt\Thumbnail.xslt:line 28
at System.Xml.Xsl.CompiledQuery.Query.<xsl:apply-templates>(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator , Double , Double )
at System.Xml.Xsl.CompiledQuery.Query.Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at System.Xml.Xsl.CompiledQuery.Query.Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)
at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results)
at umbraco.macro.GetXsltTransformResult(XmlDocument macroXML, XslCompiledTransform xslt, Dictionary`2 parameters)
at umbraco.macro.loadMacroXSLT(macro macro, MacroModel model, Hashtable pageElements)
The error ("Error parsing XSLT file: \xslt\Thumbnail.xslt") is both shown in the TinyMCE content editor as on the actual page. In the Macro I selected a image from the Media folder, put '150' in the thumbnail width textbox and ticked the Link and Lightbox tickboxes for 'yes'.
Maybe try changing your surrounding if statement from OR to AND to make sure there is an $imageid? Otherwise the GetMedia call will fail with the above error if there is no id passed
<xsl:if test="$thumbwidth != '' and $imageid != ''">
Hi Joel,
As Tom says the reason for the error is that the XSLT is checking for either $thumbwidth or $imageid.
From taking a closer look at the XSLT, I'm not happy with the number of GetMedia calls there are ... it's excessive and can be done better - like so:
Cheers, Lee.
Thanks guys,
I'll have another look at the code with your tips.
The xslt I'm using is from the Thumbnail with Lightbox 2.04 package.
Will post my findings aftewards..
I tried both the above solutions and they generated the same output:
But the output isn't being converted to an image. I tested the image directly using the following url:
~ImageGen.ashx?image=1151&width=100&constrain=true , but it gave an error: "File not found: 1151" I don't know how Umbraco and/or ImageGen.ashx are retrieving the image using the imageId, but it looks like thats the source of the problem.
The image with id '1151' is available in the Media folder and can be used by other macros.
Hi Joel,
ImageGen wont retreive the image from the media id - only the filepath (which the XSLT gets with the "umbracoFile" property value).
Just noticed something in the XSLT, the selector for the "imageid" variable isn't quite right ... try changing it to this:
Cheers, Lee.
Changing the imageid variable resulted in a return of the ("Error parsing XSLT file: \xslt\Thumbnail.xslt") error.
Is it possible to test the output of the xlst?
The following code gave me this output:
imageid:/media/330/freighthandling.jpg15011344064jpg
thumbwidth: 100
align:
linktoorig: 1
uselightbox: 1
lightboxgroup
A you can see the image url is incorrect. Why is there additional text ('15011344064jpg') added?
<xsl:param name="currentPage" />
<xsl:variable name="imageid" select="/macro/imageid" />
<xsl:variable name="thumbwidth" select="/macro/thumbwidth" />
<xsl:variable name="align" select="/macro/align" />
<xsl:variable name="linktoorig" select="/macro/linktoorig" />
<xsl:variable name="uselightbox" select="/macro/uselightbox" />
<xsl:variable name="lightboxgroup" select="/macro/lightboxgroup" />
<xsl:template match="/">
<xsl:if test="$imageid != '' ">
imageid:<xsl:value-of select="$imageid " /><br/>
thumbwidth: <xsl:value-of select="$thumbwidth" /><br/>
align: <xsl:value-of select="$align" /><br/>
linktoorig: <xsl:value-of select="$linktoorig" /><br/>
uselightbox: <xsl:value-of select="$uselightbox" /><br/>
lightboxgroup: <xsl:value-of select="$lightboxgroup" />
</xsl:if>
is working on a reply...