I have a slideshow gallery macro that I needed to use in another section of the website, so I created a new Doctype for the images and edited a copy of the existing gallery xslt file to refrence my new Doctype. After including the macro in the template for the page I receive the error; "Error parsing XSLT file: \xslt\AlumniGallery.xslt". I don't know why it wouldn't work, it's allready functioning properly on another page of the site. here is the xslt: (where AlumniGalleryItem is the new doctype)
If you don't have a reference to the image the GetMedia extension will fail. Therefore you need to make a check, to make sure galleryImage is not empty before calling the extesion like this:
Ok, then try adding ?umbdebugshowtrace=1 to url - this will give you a stack trace and hopefully it will give you a red error message. What does that error message say?
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="AlumniGalleryItem">(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 \\umbracoshare\prod\wwwroot\xslt\AlumniGallery.xslt:line 50 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.<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 \\umbracoshare\prod\wwwroot\xslt\AlumniGallery.xslt:line 23 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)
Aaah, I missed that you're also calling NiceUrl. If this one is empty too then the error will occur. The following should fix it - and I'm asuming you want to have the nodes displayed even though some images or links have not been chosen.
You have the same potential problem with the fullStoryLink property - you need to make sure that's not empty either - best way is to use the normalize-space() function:
Hmm, I wonder why you have highlighted those normalize-space() tingy's? ;-) - Steve, you should go with this example done by Chriztian. My !='' stuff is a bad nasty old habit of mine :)
@Jan - no worries :-) Using "unequals" works most of the time - but can be very hard to track down, once an editor has "cleared" a property with a space !
That's good to hear - remember to mark Chriztians answer as the solution so others coming accros this post easily can find the solution. And by marking a solution you avoid an e-mail reminder about it in about a month :).
One more thing. How would I refrence, for example, an image within a "newsStory" doctype stored within a folder in the "media" folder and have the xslt pull images from those doctypes to use in my existing "AlumniGallery" slideshow? Thanks!
Error parsing XSLT file: \xslt\AlumniGallery.xslt
I have a slideshow gallery macro that I needed to use in another section of the website, so I created a new Doctype for the images and edited a copy of the existing gallery xslt file to refrence my new Doctype. After including the macro in the template for the page I receive the error; "Error parsing XSLT file: \xslt\AlumniGallery.xslt". I don't know why it wouldn't work, it's allready functioning properly on another page of the site. here is the xslt: (where AlumniGalleryItem is the new doctype)
<?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"
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:template match="/">
<xsl:variable name="galleryImages" select="$currentPage/AlumniGalleryItem" />
<xsl:if test="count($galleryImages) > 0">
<div class="block-gallery">
<ul class="galery">
<xsl:apply-templates select="$galleryImages" />
</ul>
<div class="slider">
<a class="prev" href="#">prev</a>
<div class="switcher"> </div>
<a class="next" href="#">next</a>
</div>
</div>
</xsl:if>
</xsl:template>
<xsl:template match="AlumniGalleryItem">
<xsl:if test="galleryImage">
<li>
<img width="650" height="246">
<xsl:attribute name="src">
<xsl:value-of select="umbraco.library:GetMedia(galleryImage, 0)/umbracoFile" />
</xsl:attribute>
</img>
<div class="block-galery">
<div class="text">
<strong><xsl:value-of select="headline" /></strong>
<span><xsl:value-of select="brief" /></span>
<a class="read-story">
<xsl:attribute name="href"><xsl:value-of select="umbraco.library:NiceUrl(fullStoryLink)" /></xsl:attribute>
READ FULL STORY
</a>
</div>
<div class="links">
<xsl:value-of select="miscellaneousLinks" disable-output-escaping="yes" />
</div>
</div>
</li>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Hi Steve
If you don't have a reference to the image the GetMedia extension will fail. Therefore you need to make a check, to make sure galleryImage is not empty before calling the extesion like this:
<xsl:if test="galleryImage !=''">
<xsl:value-of select="umbraco.library:GetMedia(galleryImage, 0)/umbracoFile" />
</xsl:if>
This should do the trick.
/Jan
Jan,
I added the check to the test (seen below), but it still won't parse. Any other suggestions? Thanks!
<xsl:template match="AlumniGalleryItem">
<xsl:if test="galleryImage != ''">
<li>
<img width="625" height="246">
<xsl:attribute name="src">
<xsl:value-of select="umbraco.library:GetMedia(galleryImage, 0)/umbracoFile" />
</xsl:attribute>
</img>
<div class="block-galery">
<div class="text">
<strong><xsl:value-of select="headline" /></strong>
<span><xsl:value-of select="brief" /></span>
<a class="read-story">
<xsl:attribute name="href"><xsl:value-of select="umbraco.library:NiceUrl(fullStoryLink)" /></xsl:attribute>
READ FULL STORY
</a>
</div>
<div class="links">
<xsl:value-of select="miscellaneousLinks" disable-output-escaping="yes" />
</div>
</div>
</li>
</xsl:if>
</xsl:template>
Hi Steve
Ok, then try adding ?umbdebugshowtrace=1 to url - this will give you a stack trace and hopefully it will give you a red error message. What does that error message say?
/Jan
Jan,
Here is the error.
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="AlumniGalleryItem">(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 \\umbracoshare\prod\wwwroot\xslt\AlumniGallery.xslt:line 50
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.<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 \\umbracoshare\prod\wwwroot\xslt\AlumniGallery.xslt:line 23
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)
Hi Steve
Aaah, I missed that you're also calling NiceUrl. If this one is empty too then the error will occur. The following should fix it - and I'm asuming you want to have the nodes displayed even though some images or links have not been chosen.
<xsl:template match="AlumniGalleryItem">
<li>
<xsl:if test="galleryImage != ''">
<img width="625" height="246">
<xsl:attribute name="src">
<xsl:value-of select="umbraco.library:GetMedia(galleryImage, 0)/umbracoFile" />
</xsl:attribute>
</img>
</xsl:if>
<div class="block-galery">
<div class="text">
<strong><xsl:value-of select="headline" /></strong>
<span><xsl:value-of select="brief" /></span>
<xsl:if test="fullStoryLink !=''">
<a class="read-story">
<xsl:attribute name="href"><xsl:value-of select="umbraco.library:NiceUrl(fullStoryLink)" /></xsl:attribute>
READ FULL STORY
</a>
</xsl:if>
</div>
<div class="links">
<xsl:value-of select="miscellaneousLinks" disable-output-escaping="yes" />
</div>
</div>
</li>
</xsl:template>
The above should do the trick, but be aware that this can be done in a nicer way, which I'll post if I find some more spare time to do it :)
/Jan
Hi Steve,
You have the same potential problem with the fullStoryLink property - you need to make sure that's not empty either - best way is to use the normalize-space() function:
/Chriztian
Hmm, I wonder why you have highlighted those normalize-space() tingy's? ;-) - Steve, you should go with this example done by Chriztian. My !='' stuff is a bad nasty old habit of mine :)
/Jan
@Jan - no worries :-) Using "unequals" works most of the time - but can be very hard to track down, once an editor has "cleared" a property with a space !
/Chriztian
That did the trick! Thanks so much guys!
Hi Steve
That's good to hear - remember to mark Chriztians answer as the solution so others coming accros this post easily can find the solution. And by marking a solution you avoid an e-mail reminder about it in about a month :).
@Chriztian: The more bulletproof the better :)
/Jan
Jan or Chriztian,
One more thing. How would I refrence, for example, an image within a "newsStory" doctype stored within a folder in the "media" folder and have the xslt pull images from those doctypes to use in my existing "AlumniGallery" slideshow? Thanks!
is working on a reply...