Copied to clipboard

Flag this post as spam?

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


  • Kate 267 posts 610 karma points
    Sep 02, 2010 @ 11:30
    Kate
    0

    Need help making macro works

    Hello

    I need a little help with something I think is very basic in umbraco.
    I'm reading this article: http://umbraco.org/documentation/books/xslt-basics/what-is-xslt and follow his examples. I just can't get it to work :-(

    I created an xslt which contain the following:
    <! - Start writing XSLT ->
      <xsl:value-of select="$currentPage/@nodeName"/> <br/> <br/>
      Text: <xsl:value-of select="$currentPage/data[@alias='website']/text()"/>

    There is automatically created a macro.

    Under Settings, I've created a Document Type (plaintext) where I've created a property with the following:
    Name: Website
    Alias: website
    Type: Richtext editor
    Tab: content

    On my page under the tab "content", I have added some text.

    And on my template (under Setings), I have added my macro. Looking like this:
    <%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" AutoEventWireup="true" %>

    <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
     
      <umbraco:Macro Alias="Xxx" runat="server"></umbraco:Macro>
     
    </asp:Content>



    My problem is that I dont get any text displayed on the page.
    What am I doing wrong?
    Am I missing some settings?

    I look forward to hearing your reply.

  • Bijesh Tank 192 posts 419 karma points
    Sep 02, 2010 @ 11:33
    Bijesh Tank
    0

    Hi Kate,

    Which version of Umbraco are you using?

    Regards,

    Bijesh

  • Kate 267 posts 610 karma points
    Sep 02, 2010 @ 11:35
    Kate
    0

    I´m using umbraco v 4.5.1

     

  • Bijesh Tank 192 posts 419 karma points
    Sep 02, 2010 @ 11:37
    Bijesh Tank
    0

    You might to check what template your document type is using and make sure that your content page has the template set under Properties tab

  • Kate 267 posts 610 karma points
    Sep 02, 2010 @ 11:45
    Kate
    0

    I think all that is okay, because in my xslt I have written the word "Text" and that is displayed on my page.

     

  • Bijesh Tank 192 posts 419 karma points
    Sep 02, 2010 @ 11:49
    Bijesh Tank
    0

    Also, 4.5.1 uses the new XML schema, so the XSLT examples you were looking at are slightly out of date (for older version of Umbraco, 4.0.x).  Here's a reference how to use the new schema with some example:

    http://our.umbraco.org/wiki/reference/xslt/45-xml-schema/xslt-examples-updated-to-new-schema

     

  • Kate 267 posts 610 karma points
    Sep 02, 2010 @ 11:51
    Kate
    0

    thanks

    I will have a look at it and then I will probably get back to you :-)

     

  • Kate 267 posts 610 karma points
    Sep 02, 2010 @ 12:02
    Kate
    0

    I found this:

    <xsl:value-of select="$currentPage/* [name() = $myMacroParameter and not(@isDoc)]" />

    but ofcause it gives me an error.

    The "$myMacroParameter" I don´t know what to do with.
    Is there some settings I need to change in the Macro

    And what about [name(). What does that means?

  • Bijesh Tank 192 posts 419 karma points
    Sep 02, 2010 @ 13:08
    Bijesh Tank
    0

    So, instead of:

    <xsl:value-of select="$currentPage/data[@alias='website']/text()"/>

    Try:

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

     

  • Kate 267 posts 610 karma points
    Sep 02, 2010 @ 13:14
    Kate
    0

    It works - kind of :-)

    It writes my html on the page as well:

    http://shiftumbraco.planetshift.dk/1313.aspx

  • Bijesh Tank 192 posts 419 karma points
    Sep 02, 2010 @ 13:18
    Bijesh Tank
    0

    Ah, add disable-output-escaping - so it would be

    <xsl:value-of select="$currentPage/website" disable-output-escaping="yes"/>

     

  • Kate 267 posts 610 karma points
    Sep 02, 2010 @ 13:23
    Kate
    0

    Jubii, it works

    So I dont have to think about if it is at Node or Data that Im getting my data from?

    Thanks for your help

     

  • Bijesh Tank 192 posts 419 karma points
    Sep 02, 2010 @ 13:44
    Bijesh Tank
    0

    Glad you got it working :)

    Using the new XML schema makes it easier to work with.

  • 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