Copied to clipboard

Flag this post as spam?

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


  • anthony hall 217 posts 530 karma points
    Aug 19, 2009 @ 23:06
    anthony hall
    0

    NiceUrl from foreach

     

    I'm am getting errors with the following code. ( i've turned skip testing on )

    the following line returns @id : "1332"

    node/descendant-or-self::node [@nodeTypeAlias = 'productFabrics']/@id

    however when i use this value on niceUrl i get a parsing error. 

    ~~~~

    <xsl:for-each select="$currentPage/node [string(data [@alias='umbracoNaviHide']) != '1']">

    <a href="{umbraco.library:NiceUrl(node/descendant-or-self::node [@nodeTypeAlias = 'productFabrics']/@id)}">

    <xsl:value-of select="@nodeName"/>

    </a>

    </xsl:for-each>

    if i use $currentPage it returns a value. Any thoughts what going on here.

     

     

  • anthony hall 217 posts 530 karma points
    Aug 19, 2009 @ 23:22
    anthony hall
    0

    some more info. Here is error

    Error parsing XSLT file: \xslt\ProductRangeList.xslt

    When i "?umbDebugShowTrace=true" the stacktrace doesn't actually show an exception.  

  • Petr Snobelt 923 posts 1534 karma points
    Aug 20, 2009 @ 00:38
    Petr Snobelt
    101

    add xsl if

    <xsl:for-each 
            select="$currentPage/node [string(data [@alias='umbracoNaviHide']) != '1']">
      <xsl:variable name="id"
            select="node/descendant-or-self::node [@nodeTypeAlias = 'productFabrics']/@id" />
      <xsl:if test="$id != ''">
        <a href="{umbraco.library:NiceUrl($id)}">
          <xsl:value-of select="@nodeName"/>
        </a>
      </xsl:if>
    </xsl:for-each>

     

  • Petr Snobelt 923 posts 1534 karma points
    Aug 20, 2009 @ 00:41
    Petr Snobelt
    0

    But it looks it can be simplified like this

    <xsl:for-each select="$currentPage/node [string(data [@alias='umbracoNaviHide']) != '1']/descendant-or-self::node [@nodeTypeAlias = 'productFabrics']">
        <a href="{umbraco.library:NiceUrl(@id)}">
          <xsl:value-of select="@nodeName"/>
        </a>
    </xsl:for-each>

    Petr

  • anthony hall 217 posts 530 karma points
    Aug 20, 2009 @ 08:12
    anthony hall
    0

    cool, thanks petr!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies