Copied to clipboard

Flag this post as spam?

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


  • Przemo 2 posts 22 karma points
    Dec 01, 2010 @ 20:08
    Przemo
    0

    xsl:when problem

    Hi

    i'm trying to build  menu.

    <?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:variable name="level" select="1"/>

    <xsl:template match="/">

    <!-- The fun starts here -->
      <ul>
        <li> <a href="/">Start</a></li>
        <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc and @level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
          <li>
            <a>
              <xsl:attribute name="href">
                <xsl:choose>
                  <xsl:when test="count(./*[@isDoc]) = 1">
                    <xsl:value-of select="umbraco.library:NiceUrl(./node/@id)" />
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:value-of select="umbraco.library:NiceUrl(@id)" />
                  </xsl:otherwise>
                </xsl:choose>
              </xsl:attribute>
              <xsl:value-of select="menuTitle"/>
            </a>
          </li>
        </xsl:for-each>
      </ul>

    </xsl:template>
    </xsl:stylesheet>

    why after change  "=" to "&gt;" or ">" in line <xsl:when test="count(./*[@isDoc] =1">  i've got error System.OverflowException: Value was either too large or too small for an Int32.?

  • Sebastian Dammark 583 posts 1407 karma points
    Dec 01, 2010 @ 20:58
    Sebastian Dammark
    0

    What is the value of count(./*[@isDoc]) ?

     

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 01, 2010 @ 21:13
    Jan Skovgaard
    0

    Hi

    Have you tried to check the "skip error testing" - even though you get the error in the editor it might be working if you skip the error testing. It has to do with the values first being accessible on runtime I guess...

    /Jan

  • Kim Andersen 1447 posts 2196 karma points MVP
    Dec 01, 2010 @ 21:38
    Kim Andersen
    0

    I think the error occours because you are using the "node" in your xpath. Try changing this line:

    <xsl:value-of select="umbraco.library:NiceUrl(./node/@id)" />

    To this:

    <xsl:value-of select="umbraco.library:NiceUrl(./*[@isDoc]/@id)" />

    /Kim A

Please Sign in or register to post replies

Write your reply to:

Draft