Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Steve 472 posts 1216 karma points
    Sep 10, 2012 @ 15:53
    Steve
    0

    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 "&#x00A0;"> ]>
    <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) &gt; 0">
        
        <div class="block-gallery">
          <ul class="galery">
            <xsl:apply-templates select="$galleryImages" />
          </ul>
          <div class="slider">
            <class="prev" href="#">prev</a>
            <div class="switcher">&nbsp;</div>
            <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>
              <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>

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Sep 10, 2012 @ 19:19
    Jan Skovgaard
    0

    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

  • Steve 472 posts 1216 karma points
    Sep 10, 2012 @ 19:42
    Steve
    0

    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>
              <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>

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Sep 10, 2012 @ 19:49
    Jan Skovgaard
    0

    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

  • Steve 472 posts 1216 karma points
    Sep 10, 2012 @ 19:51
    Steve
    0

    Jan,

    Here is the error.

    umbracoMacro InnerException 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)
  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Sep 10, 2012 @ 21:04
    Jan Skovgaard
    0

    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 !=''">          

    <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

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Sep 10, 2012 @ 21:05
    Chriztian Steinmeier
    1

    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:

    <xsl:template match="AlumniGalleryItem">
        <xsl:if test="normalize-space(galleryImage)">
            <li>
                <xsl:variable name="mediaNode" select="umbraco.library:GetMedia(galleryImage, 0)" />
                <img src="{$mediaNode/umbracoFile}" width="625" height="246" />
            </li>
            <div class="block-galery">
                <div class="text">
                    <strong><xsl:value-of select="headline" /></strong>
                    <span>val</span>
                    <xsl:if test="normalize-space(fullStoryLink)">
                        <a class="read-story" href="{umbraco.library:NiceUrl(fullStoryLink)}">READ FULL STORY</a>
                    </xsl:if>
                </div>
                <div class="links">
                    <xsl:value-of select="miscellaneousLinks" disable-output-escaping="yes" />
                </div>
            </div>        
        </xsl:if>
    </xsl:template>
    

    /Chriztian

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Sep 10, 2012 @ 21:07
    Jan Skovgaard
    0

    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

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Sep 10, 2012 @ 21:12
    Chriztian Steinmeier
    0

    @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

  • Steve 472 posts 1216 karma points
    Sep 10, 2012 @ 21:19
    Steve
    0

    That did the trick! Thanks so much guys!

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Sep 10, 2012 @ 21:43
    Jan Skovgaard
    0

    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

  • Steve 472 posts 1216 karma points
    Sep 11, 2012 @ 19:43
    Steve
    0

    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!

Please Sign in or register to post replies

Write your reply to:

Draft