Copied to clipboard

Flag this post as spam?

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


  • Trine 29 posts 89 karma points
    Jun 15, 2013 @ 11:39
    Trine
    0

    Document Type not showing on page

    I am a newbie with Umbraco so please excuse if I am missing something obvious. I have trawled the internet, but I can't find a solution to my problem. If this should be in a different place on the forum, let me know and I'll repost it in it's correct place.

    I am mainly using the Umbraco.TV videos to guide me through this, and in particular, this one: http://umbraco.com/help-and-support/video-tutorials/umbraco-fundamentals/datatypes/using-content-and-media-pickers/TVPlayer.

    The others videos and tutorials successfully got me through setting up a responsive nav and sub-nav, but on this issue, I'm stuck.

    I am building a site which requires multiple CTAs. The text for these need to be entered by persons who have no coding experience so I've set up Document Types containing RichText Editor fields for them to enter the required text and images.

    Tab: Generic Properties

    H2 (h2), Type: Richtext editor
    Article Description (articleDescription), Type: Richtext editor
    Article Feature Image (articleFeatureImage), Type: Media Picker
    Label (label), Type: Label
    

    In the Template I have then inserted an Umbraco page field which references the relevant Document Type:

    <div class="rel-art">
    <umbraco:Item field="relatedContent1" runat="server" />
    </div>
    

    However, when I view the page in a browser, all I'm getting on the page is the Document Type ID:

    <div class="rel-art"> 1202 </div> 
    

    I have tried setting it up and inserting it as an xslt:

    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:param name="currentPage"/>
    <xsl:template match="/">
    <xsl:value-of select="umbraco.library:GetXmlNodeById($currentPage/data [@alias = 'relatedContent1'])/@nodeName"/>
    </xsl:template>
    </xsl:stylesheet>
    

    My "Visualise XSLT" button isn't working though so I don't know what is would say at this point. I don't get a modal window. (I'm working remotely onto my client's system so that may have an impact.)

    Now, if I insert the accompanying Macro into my template:

    <div class="rel-art">
    <umbraco:Macro Alias="RelatedContent1" runat="server"></umbraco:Macro>
    </div>
    

    that results in not even the ID showing when I view the page:

        <div class="rel-art">  </div> 
    

    I have tried with and without @nodeName, but no difference.

    What is happening? What am I doing wrong? The only thing I can think of is that I had some trouble getting another Document Type to show up on the page until I changed its only Property Type from RichText Editor to Textstring. But I tried that with this one as well, and that didn't make any difference.

    I am using Umbraco v4.9, if that helps.

    Any help is gratefully received!

    Thanks! :-)

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jun 15, 2013 @ 11:50
    Jan Skovgaard
    0

    Hi Trine and weclome to our :)

    Never be afraid to ask any kind of question in here - we're a really friendly bunch of people who love to help each other out.

    If there is something that you can't figure out it's most likely because there is a lack of either documentation or that things are not inituitive enough to figure out easily. So please just keep asking if something does not make sense.

    Ok, so now to deal with your problem...

    First of all - what version of Umbraco are you using?

    The XSLT you're writing above is matching the old XML schema, which was changed in version 4.5 - therefore you won't see anything on the page.

    I suggest you try going to "developer" section in Umbraco and right click the XSLT folder and choose to create an XSLT file from one of those premade options there are - does that output anything?

    Looking forward to hearing from you.

    /Jan

  • Trine 29 posts 89 karma points
    Jun 15, 2013 @ 16:00
    Trine
    0

    Hi Jan!

    Thank you for answering so quickly!

    I'm using version 4.9, so if something changed in 4.5, that may be the where the problem lies!

    Below is the full XSLT for the related content container (which is the one which isn't working) and the top navigation (which works fine.) The first one was created using a Clean template and the text in bold was put in by me based on the video I mentioned in the first post. If this video was created using a pre 4.5 version of Umbraco, then the code I put in must be what is outdated.

    Related Content XSLT. Doesn't work:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:msxml="urn:schemas-microsoft-com:xslt"
        xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:twitter.library="urn:twitter.library" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch" xmlns:google.maps="urn:google.maps"
        exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets twitter.library PS.XSLTsearch google.maps ">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

        <xsl:value-of select="umbraco.library:GetXmlNodeById($currentPage/data [@alias = 'relatedContent1'])/@nodeName"/>

    </xsl:template>

    </xsl:stylesheet>

     

     

    The following Navigation XSLT was created using List Subpages by Level, and I only inserted the Home li (in bold), so the navigation would include a link to the hompage.

    Navigation XSLT. Works perfectly:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:msxml="urn:schemas-microsoft-com:xslt"
        xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:twitter.library="urn:twitter.library" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch" xmlns:google.maps="urn:google.maps"
        exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets twitter.library PS.XSLTsearch google.maps ">

    <xsl:output method="xml" omit-xml-declaration="yes" />

    <xsl:param name="currentPage"/>

    <!-- Input the documenttype you want here -->
    <xsl:variable name="level" select="1"/>

    <xsl:template match="/">

    <!-- The fun starts here -->
       
    <ul>
       
                     <li class="first"><a href="/">Home</a></li>

    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
       
        <li>
            <a href="{umbraco.library:NiceUrl(@id)}">
                <xsl:value-of select="@nodeName"/>
            </a>
        </li>
    </xsl:for-each>
    </ul>

    </xsl:template>

    </xsl:stylesheet>

     

    Could it be that the code I got from the Umbraco video is outdated? I'm going to need to use the Clean XSLT template quite a lot for this project and I'm sort of relying on the videos for the XML, so if the videos are out of date, then I'm in a bit of trouble... A crash course in XML is needed I think :-)

     

    Thank you again!!

     

    Trine

  • Trine 29 posts 89 karma points
    Jun 16, 2013 @ 14:51
    Trine
    0

    I have read something about the v4.9 XSLT editor not working properly. Could this have an impact on my problem?

    I'm still not sure what I have to do to make it work properly...

  • Mads Jørgensen 74 posts 226 karma points
    Jun 16, 2013 @ 16:49
    Mads Jørgensen
    0

    Hi Trine,

    The highlighted line with the error is as Jan is saying based on the old XML scheme. Try the following:

     <xsl:value-of select="umbraco.library:GetXmlNodeById($currentPage/relatedContent1)/@nodeName"/>

    The new scheme don't use the data nodes, but the name of the attributes.

  • Mads Jørgensen 74 posts 226 karma points
    Jun 16, 2013 @ 17:03
    Mads Jørgensen
    0

    Or even better:

    <xsl:key name="document-by-id" match="*[@isDoc]" use="@id" />
    <xsl:template match="/">
    <xsl:apply-templates select="$currentPage" mode="page" />
    </xsl:template>

    <xsl:template match="*" mode="page" >
    <xsl:apply-templates select="key('document-by-id', relatedContent1)" mode="related" />
    </xsl:template> 

    <xsl:template match="*" mode="related">
    <xsl:value-of select="@nodeName" />
    </xsl:template> 

    This way you'll use the key() function in xslt, witch is pretty fast :-) A bit harder to grasp though!

  • Trine 29 posts 89 karma points
    Jun 19, 2013 @ 23:17
    Trine
    0

    Now I'm not ignoring this, but I'm working remotely onto my client's system and their remote system has been down for 4 days now so I can't actually test it out at the moment... :-(

    I'll let you know how it goes as soon as I can though! :-)

  • Trine 29 posts 89 karma points
    Jun 23, 2013 @ 23:56
    Trine
    0

    Awsome!

    worked and the page is now showing the node name. :-)

    Firebug code is showing:

     id="left_container">

    <div class="rel-art"> 24hr Branches Link div>

     
    div>

     

    So, the text for these need to be entered by persons who have no coding experience so I've set up Document Types containing RichText Editor fields for them to enter the required text and images.

    Tab: Generic Properties

    H2 (h2),Type:Richtext editor
    ArticleDescription(articleDescription),Type:Richtext editor
    ArticleFeatureImage(articleFeatureImage),Type:MediaPicker
    Label(label),Type:Label

    How do I specify these so that the page displays the H2, article description and feature image? I haven't seen a tutorial for it.

     

    This has a template:

       
           
           

    Lorem Ipsum


           
       
       

       

    (it's not showing the Lorem Ipsum)

    and of course the now working XSLT file:


       

       

       

           

       

       

     

    So which ones of these do I have to amend to get the H2, article description and feature image to show and what does it need to be? How can I then style each one individually? Can I use

    in the XSLT file?

    You may have guessed that I'm a newbie and you guys are teaching me so much about Umbraco and XML!

     

    Thanks! :-) 

  • Trine 29 posts 89 karma points
    Jun 24, 2013 @ 00:01
    Trine
    0

    Awsome!

    <xsl:value-of select="umbraco.library:GetXmlNodeById($currentPage/relatedContent1)/@nodeName"/> worked and the page is now showing the node name. :-)

    Firebug code is showing:

    <div id="left_container">

    <div class="rel-art"> 24hr Branches Link </div>

    </div>

     

    So, the text for these need to be entered by persons who have no coding experience so I've set up Document Types containing RichText Editor fields for them to enter the required text and images.

    Tab: Generic Properties

    H2 (h2),Type:Richtext editor
    ArticleDescription(articleDescription),Type:Richtext editor
    ArticleFeatureImage(articleFeatureImage),Type:MediaPicker
    Label(label),Type:Label

    How do I specify these so that the page displays the H2, article description and feature image? I haven't seen a tutorial for it.

     

    This has a template:

            <%@ Master Language="C#" MasterPageFile="~/masterpages/Main.master" AutoEventWireup="true" %>
                <asp:Content ContentPlaceHolderId="ContentArea" runat="server">
                <h2>Lorem Ipsum</h2>
                </asp:Content>
            <%@ Master Language="C#" MasterPageFile="~/masterpages/Main.master" AutoEventWireup="true" %>
            <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">

           </asp:Content>

     

    and of course the now working XSLT file:


            <xsl:output method="xml" omit-xml-declaration="yes"/>

            <xsl:param name="currentPage"/>

            <xsl:template match="/">

                <xsl:value-of select="umbraco.library:GetXmlNodeById($currentPage/relatedContent1)/@nodeName"/>

            </xsl:template>

            </xsl:stylesheet>

     

    So which ones of these do I have to amend to get the H2, article description and feature image to show and what does it need to be? How can I then style each one individually? Can I use <div> in the XSLT file?

    You may have guessed that I'm a newbie and you guys are teaching me so much about Umbraco and XML!

     

    Thanks! :-) 

  • Trine 29 posts 89 karma points
    Jun 24, 2013 @ 00:03
    Trine
    0

    Awsome!

    <xsl:value-of select="umbraco.library:GetXmlNodeById($currentPage/relatedContent1)/@nodeName"/> worked and the page is now showing the node name. :-)

    Firebug code is showing:

    <div id="left_container">

    <div class="rel-art"> 24hr Branches Link </div>

    </div>

     

    So, the text for these need to be entered by persons who have no coding experience so I've set up Document Types containing RichText Editor fields for them to enter the required text and images.

    Tab: Generic Properties

    H2 (h2),Type:Richtext editor
    ArticleDescription(articleDescription),Type:Richtext editor
    ArticleFeatureImage(articleFeatureImage),Type:MediaPicker
    Label(label),Type:Label

    How do I specify these so that the page displays the H2, article description and feature image? I haven't seen a tutorial for it.

     

    This has a template:

            <%@ Master Language="C#" MasterPageFile="~/masterpages/Main.master" AutoEventWireup="true" %>
                <asp:Content ContentPlaceHolderId="ContentArea" runat="server">
                </asp:Content>
            <%@ Master Language="C#" MasterPageFile="~/masterpages/Main.master" AutoEventWireup="true" %>
            <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">

           </asp:Content>

     

    and of course the now working XSLT file:


            <xsl:output method="xml" omit-xml-declaration="yes"/>

            <xsl:param name="currentPage"/>

            <xsl:template match="/">

                <xsl:value-of select="umbraco.library:GetXmlNodeById($currentPage/relatedContent1)/@nodeName"/>

            </xsl:template>

            </xsl:stylesheet>

     

    So which ones of these do I have to amend to get the H2, article description and feature image to show and what does it need to be? How can I then style each one individually? Can I use <div> in the XSLT file?

    You may have guessed that I'm a newbie and you guys are teaching me so much about Umbraco and XML!

     

    Thanks! :-) 

Please Sign in or register to post replies

Write your reply to:

Draft