Copied to clipboard

Flag this post as spam?

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


  • Hector 1 post 21 karma points
    Dec 05, 2011 @ 23:52
    Hector
    0

    Issues parsing my ServiceSElection.xslt file.

    Hi there, I was wondeing if there was a way be able to help me troubleshoot this issue. On the front page of a client's website, I get the following error:

    Error parsing XSLT file: \xslt\ServiceSelection.xslt. 

    Based on some preliminary research that I have done, I was believe that the issue here might lie with the NiceURL bit. I added the debug parameters to the URL and was able to find this all in bold red:

    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.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)
      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:\WEBSITES_Test\lfh.switchfast.net\xslt\ServiceSelection.xslt:line 31
      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, XmlSequenceWriter results)
      at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)
      at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, XmlWriter results, XmlResolver documentResolver)
      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)
    0.0234591267884605 0.000581

     

    As a result, I was wondering if there's a way to be able to pin-point the issue. My \xslt\ServiceSelection.xslt code looks like the following:

     

    <?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" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch" 
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary PS.XSLTsearch ">

    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:param name="currentPage"/>
    <xsl:template match="/">
    <xsl:if test="$currentPage/serviceBox != ''">
        <xsl:variable name="selectedTribute" select="umbraco.library:GetXmlNodeById($currentPage/serviceBox)"/>
        <h2>Service for... <i class="white"><xsl:value-of select="$selectedTribute/animalName" disable-output-escaping="yes"/></i></h2>
    <xsl:if test="$selectedTribute/animalThumbnail != ''">
      <div class="thumbnail">
          <img>
        <xsl:attribute name="src">/usercontrols/imageTool.ashx?minheight=95&amp;minwidth=95&amp;image=<xsl:value-of select="$selectedTribute/animalThumbnail "/></xsl:attribute>
          </img>
      </div>
    </xsl:if>
        <p><xsl:value-of select="umbraco.library:TruncateString($selectedTribute/eventSummary, 150, '...')" disable-output-escaping="yes"/>
        </p>
        <p class="readmore"><a href="{umbraco.library:NiceUrl($selectedTribute/@id)}">READ MORE ></a></p>
        
      </xsl:if>

    </xsl:template>
    </xsl:stylesheet>
    Any <?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" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch" 
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary PS.XSLTsearch ">
    
    
    <xsl:output method="xml" omit-xml-declaration="yes"/>
    
    <xsl:param name="currentPage"/>
    
    <xsl:template match="/">
    
    <xsl:if test="$currentPage/serviceBox != ''">
        <xsl:variable name="selectedTribute" select="umbraco.library:GetXmlNodeById($currentPage/serviceBox)"/>
    
        <h2>Service for... <i class="white"><xsl:value-of select="$selectedTribute/animalName" disable-output-escaping="yes"/></i></h2>
    <xsl:if test="$selectedTribute/animalThumbnail != ''">
      <div class="thumbnail">
          <img>
        <xsl:attribute name="src">/usercontrols/imageTool.ashx?minheight=95&amp;minwidth=95&amp;image=<xsl:value-of select="$selectedTribute/animalThumbnail "/></xsl:attribute>
          </img>
      </div>
    </xsl:if>
    
        <p><xsl:value-of select="umbraco.library:TruncateString($selectedTribute/eventSummary, 150, '...')" disable-output-escaping="yes"/>
        </p>
        <p class="readmore"><a href="{umbraco.library:NiceUrl($selectedTribute/@id)}">READ MORE ></a></p>
    
      </xsl:if>
    
    
    </xsl:template>
    
    </xsl:stylesheet>

     

    I am running Umbraco v. 4 with ASP.NET v.4 in a Windows IIS 6. environment.

    Any help would be greatly appreciated!

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Jan 25, 2012 @ 17:22
    Lee Kelleher
    1

    Hi Hector,

    It's been a good several weeks since you posted this, not sure if you've already resolved this?

    I believe the reason for the error is either the call to GetXmlNodeById or NiceUrl - my guess would be its NiceUrl.  To get around this, you'll need to wrap the link with an <xsl:if> to test that the @id has a value:

    <xsl:if test="$selectedTribute/@id != ''">
        <p class="readmore"><a href="{umbraco.library:NiceUrl($selectedTribute/@id)}">READ MORE ></a></p>
    </xsl:if>

    Cheers, Lee.

Please Sign in or register to post replies

Write your reply to:

Draft