Copied to clipboard

Flag this post as spam?

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


  • Lars Mortensen 90 posts 98 karma points
    Jun 14, 2009 @ 17:23
    Lars Mortensen
    0

    Macro not working on sub nodes

    I have a "Main site Layout" Doc type, and some content sub pages.
    On the layout doc type I have an imagepicker to pick a logo.
    On the frontpage which uses the main doctype itself works flavless, but when I Click on a content sub page I just get Error parsing XSLT file: \xslt\ImgGen.xslt

    Not sure where the error is, but if it's some xslt related then here is the code:
    [quote]

    [/quote]

    Not sure wether or not the disable-output-escaping should be there, just thought it might be the solution, but no.

    Why do I get an error on the sub pages?

    /Lars Mortensen

  • Finn 86 posts 50 karma points
    Jun 14, 2009 @ 19:36
    Finn
    0

    When it works fine on the main (front) page, it's usually the url thats wrong.

    What about:

  • Lars Mortensen 90 posts 98 karma points
    Jun 14, 2009 @ 23:32
    Lars Mortensen
    0

    [quote=fdo]When it works fine on the main (front) page, it's usually the url thats wrong.

    What about:

    [/quote]
    Hi

    I have tried your line, but the same.

    And I don't think the error is about the url, because then it would display the redcross'ed picture here instead of a picture I get the text "Error parsing XSLT file: \xslt\ImgGen.xslt"

    Look here: Working page / front page
    And here: Non working / sub page.

    Any other thoughts?

    /Lars

  • kmacdonell 28 posts 45 karma points
    Jun 25, 2009 @ 02:12
    kmacdonell
    0

    Try replacing:

    $currentPage/data [@alias=$imgAlias]

    with

    $currentPage/ancestor-or-self::node [string(data[@alias=$imgAlias])!=''] [position()=1] /data[@alias=$imgAlias]

    When you are on the main page your xslt works fine because $currentPage has a data item with the alias that you are passing in. When you go onto a sub page of a different doctype then that alias no longer exists so $currentPage/data [@alias=$imgAlias] doesn't return anything.

    If you use the ancestor-or-self notation then it will still check the current page (so it will still work on the main page) and it will also check the parent page. The extra checks ensure that the closest ancestor node with a value present is returned.

    Have a look at this post for a great explanation of the recursive display technique:

    http://forum.umbraco.org/yaf_postst2751_XSLT-Tip--Display-a-field-recursively.aspx

    Cheers,
    Kev

     

     

Please Sign in or register to post replies

Write your reply to:

Draft