Copied to clipboard

Flag this post as spam?

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


  • Mario 5 posts 25 karma points
    Mar 17, 2010 @ 22:40
    Mario
    0

    XSTL Content

    Hi friends, im using XST to show the content of a node, but i still cant. Im using this example

    <ul>

         <xsl:for-each select="$currentPage/node">

              <li><a href="{umbraco.library:NiceUrl(current()/@id)}">

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

              </a></li>

         </xsl:for-each>

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

    </ul>

    But i dont know how to show the CONTENT of each node, can you help me please?

    Thank you my friends.

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Mar 17, 2010 @ 23:00
    Jan Skovgaard
    1

    Hi Mario

    If you have defined som properties on your document type you can access them in your XSLT by writing something like

    <xsl:value-of select="$currentPage/data [@alias ='nameofyourproperty']" />

    Since you are using a loop in your example you could write something like this

    <ul>
    <xsl:for-each select="$currentPage/node">

       <li><xsl:value-of select="data[@alias = 'nameofyourproperty']" /></li>

    </xsl:for-each>
    </ul>

    In the loop you don't have to call the $currentPage parameter because you are retrieving the values of all it's subnodes.

    You can see some examples of the aliases that exits if you click on the button straight to the right of the blue "save" icon in the XSLT editor of Umbraco. Then you will get a prompt, which has a dropdown box, in which it says "Prevalues..." -

    From here you can select between som default umbraco document properties such as @nodeName,@createDate and so on. These are standard properties and will always be there. Beneath the list of standard properties you can see your custom properties, which are named "data [@alias ='nameofyourproperty']" where "nameofyourproperty" is the name you have given the property.

    If you for instance have created a property for rich text editing and called it "bodyText" in the alias field, when you created your document type under the "settings" section then it would be listed as data[@alias ='bodyText'] in the prevalues dropdown box.

    I hope that it all makes sense to you :-)

    /Jan

  • Mario 5 posts 25 karma points
    Mar 17, 2010 @ 23:46
    Mario
    0

    Thanks Jan =) I undestand a few more of the propierties of my node, thank you very much bro.

    When i retrieve my content, this shows with additional html, like <p>. Any suggestion of how i can format the content?

    I dont find the properties that you name, i have to click right in thew save icon of the xslt editor?

    Thanks a lot =) 

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Mar 18, 2010 @ 00:27
    Jan Skovgaard
    0

    Glad it helped a little.


    To get the html renderen you need to add the attribute "disable-output-escaping="yes" to the <xsl:value-of select="" />

    This is primarily used when you are fetching rich text content, that has been formatted with HTML tags.

    So you need to write <xsl:value-of select="data[@alias = 'bodyText'] disable-output-escaping="yes" />

    No, you need to click to the icon next to it :) when you hold your mouse over it you'll see a title text saying "Insert XSLT:Value-of..."

    Hope it helps :-)

    Enjoy - hours of fun are waiting right ahead!

    /Jan

  • Mario 5 posts 25 karma points
    Mar 19, 2010 @ 00:34
    Mario
    0

    Thanks again Jan, I have found the fields, thanks a lot my friend.

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Mar 21, 2010 @ 17:16
    Jan Skovgaard
    0

    Hi Mario

    Glad it helped. I just came across this blogpost by Frederik Vig that can maybe also be a good beginning reference for you.

    http://www.frederikvig.com/2010/03/starting-out-with-xslt-in-umbraco/

    /Jan

  • Hendy Racher 861 posts 3844 karma points MVP 2x admin c-trib
    Mar 21, 2010 @ 18:40
    Hendy Racher
    0

    Arh ha, nice, another feed for the Umbraco Community Blogs :)

  • 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