I have the following code in an XSLT file that works well in displaying an image that can be selected using a media picker. The problem is when an image is not selected I get the following error: "Error parsing XSLT file: \xslt\place-image.xslt".
Is there a way to modify my code so that if an image is not selected then it just doesn't show anything rather than the error text. Many thanks. My code so far is as follows:
[code]
(Part after != should read as quote-quote-double quote", quote-quote for empty string and double quote to end the test attribute of the xsl:if statement)
Should use an if statement to check for a value:
[code]
[/code]
(Part after != should read as quote-quote-double quote", quote-quote for empty string and double quote to end the test attribute of the xsl:if statement)
I should have read your post more carefully. Apparantly, you already have the if test in place, which looks ok to me... Have any info on the trace? (Append ?umbdebugshowtrace=true to the current url)
umbracoMacro Error parsing XSLT System.Xml.Xsl.XslCompiledTransform
Value was either too large or too small for an Int32.
at System.Convert.ToInt32(Double value)
at System.Double.System.IConvertible.ToInt32(IFormatProvider provider)
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, IList1[] args)<br />
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, IList1 {urn:schemas-microsoft-com:xslt-debug}namespaces) in D:\Webpub\wonderfulprojects.co.uk\SubDomains\nhs\www\xslt\place-image.xslt:line 25
at System.Xml.Xsl.CompiledQuery.Query.
Displaying image IF one is available
I have the following code in an XSLT file that works well in displaying an image that can be selected using a media picker. The problem is when an image is not selected I get the following error: "Error parsing XSLT file: \xslt\place-image.xslt".
Is there a way to modify my code so that if an image is not selected then it just doesn't show anything rather than the error text. Many thanks. My code so far is as follows:
[code]
[/code]
Hi Tony,
Should use an if statement to check for a value:
(Part after != should read as quote-quote-double quote", quote-quote for empty string and double quote to end the test attribute of the xsl:if statement)
Regards,
/Dirk
Hi Tony,
Should use an if statement to check for a value:
[code]
[/code]
(Part after != should read as quote-quote-double quote", quote-quote for empty string and double quote to end the test attribute of the xsl:if statement)
Regards,
/Dirk
Sorry Dirk,
I'm not 100% sure where that part would go, would it replace
Hi tony,
I should have read your post more carefully. Apparantly, you already have the if test in place, which looks ok to me... Have any info on the trace? (Append ?umbdebugshowtrace=true to the current url)
Regards,
/Dirk
Hi Dirk,
This is what shows up:
umbracoMacro Error parsing XSLT System.Xml.Xsl.XslCompiledTransform
Value was either too large or too small for an Int32.
at System.Convert.ToInt32(Double value)
at System.Double.System.IConvertible.ToInt32(IFormatProvider provider)
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)<br /> 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 D:\Webpub\wonderfulprojects.co.uk\SubDomains\nhs\www\xslt\place-image.xslt:line 25at System.Xml.Xsl.CompiledQuery.Query.
Tony, Dirk,
you're both right here.
Tony checks for a value being empty, Dirk uses the right value to check for.
So, yes Tony, replace
Thank you Peter and Dirk,
That is now working perfectly.
is working on a reply...