Copied to clipboard

Flag this post as spam?

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


  • Sam 184 posts 209 karma points
    Oct 01, 2010 @ 20:47
    Sam
    0

    Listing page fields in new schema 4.5

    Hi, I am trying to make a simple list using:

    <ul>
    <xsl:for-each select="$currentPage/* [not(@isDoc)]">
      <li>
          <xsl:value-of select="string(MY-ALIAS-HERE)" />
      </li>
    </xsl:for-each>
    </ul>

    I have a page field (alias is on the subpages of page where this list is displayed) but I can't seem to call the values in the page field to display in this list? This is just a list too, no links or anything remotely complex. My xslt is shaky at best with the old schema, I would have used:

    <ul>
    <xsl:for-each select="$currentPage/node">
      <li>
          <xsl:value-of select="data[@alias='MY-ALIAS-HERE']" />
      </li>
    </xsl:for-each>
    </ul>

    Any ideas for the 4.5 version of the above code? Don't really understand isDoc although I have read the tutorial here:

    http://our.umbraco.org/forum/core/41-feedback/9277-New-xml-schema---can-someone-explain-isDoc

    Using the code above, I get the bullets, but no values. If I leave out the [not(@isDoc)], I get the bullets with no values. If I use [@isDoc] I get no list at all. Any ideas?

    Thanks,

    Sam.

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

    Hi Sam

    If you want to create a list with content from the current pages children, you should be able to do it like this:

    <ul>
    <xsl:for-each select="$currentPage/* [@isDoc]">
      <li>
          <xsl:value-of select="./MY-ALIAS-HERE" />
      </li>
    </xsl:for-each>
    </ul>

    The above code runs through all of the children on the level under the current page, and will create a <li> for each of the nodes.

    /Kim A

  • Sam 184 posts 209 karma points
    Oct 01, 2010 @ 22:32
    Sam
    0

    Hi Kim, thanks, but no luck with that either, I tried that combo earlier, I thought it would work too.

    The above code means no menu at all shows on the page, not even the list bullets. Running version 4.5.1 so I'm not sure why this doesn't work.

    Strangely, on trying the old schema, the following DOES list the correct values:

    <ul>
    <xsl:for-each select="$currentPage/node">
      <li>
            <xsl:value-of select="data[@alias='MY-ALIAS-HERE']" />
      </li>
    </xsl:for-each>
    </ul>

    ...but running 4.5.1 here?!

    Sam.

  • Rich Green 2246 posts 4008 karma points
    Oct 02, 2010 @ 09:51
    Rich Green
    0

    Are you sure that you're not using 4.5.1 with the old schema? There's a setting in the web.config file which allows this to happen

    <UseLegacyXmlSchema>true</UseLegacyXmlSchema>

    You may already know this but all the published nodes are in a file named "umbraco.config" in the App_Data folder, open this file in notepad / visual studio and you can see what XML is being published, this can be really useful when debugging XSLT.

    Rich 

  • Sam 184 posts 209 karma points
    Oct 02, 2010 @ 11:41
    Sam
    0

    Thanks Rich, I didn't know that. But I also don't have ftp access to this site so can't check it. I have to presume that's the case seeing as the new schema doesn't work :)

    Sam.

Please Sign in or register to post replies

Write your reply to:

Draft