Copied to clipboard

Flag this post as spam?

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


  • Kory Doszpoly 19 posts 39 karma points
    Sep 08, 2012 @ 04:56
    Kory Doszpoly
    0

    Trouble with 'Insert xslt:value-of'

    I'm trying to include the conents of a field using the insert value-of method in an xslt file. I click on the icon 'Insert xslt:value-of', scroll to the field I'm looking for, select it and finally click the 'Insert value' button. The code appears in the file, but  when I save it and reload the page in the browser it doesn't show up. I tried a variety of fields and I get the same thing. What am I missing here?

  • Fuji Kusaka 2203 posts 4220 karma points
    Sep 08, 2012 @ 06:24
    Fuji Kusaka
    0

    Hi Kory,

    Can you tell us more about what you are trying to achieve and if possible your xslt?

     

    //fuji

     

  • Drew 165 posts 340 karma points
    Sep 08, 2012 @ 12:59
    Drew
    0

    Assuming you are using xsl:value-of in a Macro, are you calling that macro from your page?

    Have you looked in the page source, after it has loaded, to see if its there but just not showing on the front end?

    I would recommend that you have a look at using the Visualise XSLT button to select a page on your website and see what the macro is out-putting.

     

     

     

    Click "Encode/decode result" to see tyhe pure HTML generated by your macro.

     

    If you are still having trouble, it may help if you post your XSLT here.

     

    Cheers,
    Drew 

  • Kory Doszpoly 19 posts 39 karma points
    Sep 08, 2012 @ 17:36
    Kory Doszpoly
    0

    I guess a little clarification is on order. Thanks by the way.

    The page in question is pulling everything it displays from a macro (actually a bunch of macros). Everything I've done so far works as intended.

    The xslt I'm trying to add stuff to is CoursePage.xslt. Again, this works fine so far. The problem is that when I try to pull in the contents of a field by using 'Insert xslt:value-of' nothing is display (I looked at the visualziation and the source code of the page in the browser).

    The field I'm trying to get is

    <xsl:value-of select="aboutGrandfatherImage" disable-output-escaping="yes"/>

    This field does have an image in it (all other fields I tried had something in them as well). I have a page that displays it very nicely. In that case, the field is directly inserted into the template for that page.


    Here is the entire xslt. The field is at the very bottom

    <?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:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary ">

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

    <xsl:param name="currentPage"/>

    <!-- Don't change this, but add a 'contentPicker' element to -->
    <!-- your macro with an alias named 'source' -->
    <xsl:variable name="source" select="/macro/source"/>

    <xsl:template match="/">
      
    <script type="text/javascript">
      
    function changeTab(item){
      
      document.getElementById("desc").style.display = "none";
      document.getElementById("high").style.display = "none";
      document.getElementById("test").style.display = "none";
      document.getElementById("volu").style.display = "none";
      
      document.getElementById(item).style.display = "inline-block";
     
      document.getElementById("desctab").style.color = "#a32e05";
      document.getElementById("hightab").style.color = "#a32e05";
      document.getElementById("testtab").style.color = "#a32e05";
      document.getElementById("volutab").style.color = "#a32e05";
      document.getElementById("desctab").style.background = "#b4c9d0";
      document.getElementById("hightab").style.background = "#b4c9d0";
      document.getElementById("testtab").style.background = "#b4c9d0";
      document.getElementById("volutab").style.background = "#b4c9d0";
      document.getElementById("desctab").style.cursor = "pointer";
      document.getElementById("hightab").style.cursor = "pointer";
      document.getElementById("testtab").style.cursor = "pointer";
      document.getElementById("volutab").style.cursor = "pointer";
      
      var itemTab = item+"tab";

      document.getElementById(itemTab).style.color = "#eef2ee";
      document.getElementById(itemTab).style.background = "#a32e05";
      document.getElementById(itemTab).style.cursor = "default";
    }
      
    </script>
      
    <!-- name of course from query string -->
    <xsl:variable name="course" select="umbraco.library:RequestQueryString('course')"/>

    <!-- Course Title -->
    <h1 class="pageTitle">
    <xsl:value-of select="umbraco.library:RenderMacroContent(concat('&lt;?UMBRACO_MACRO macroAlias=&quot;CourseTitle&quot; source=&quot;', $source, '&quot; runat=&quot;server&quot; /&gt;'), $currentPage/@id)" disable-output-escaping="yes" />
    </h1>
      
     
      
      <table cellpadding="0" cellspacing="0" border="0" style="margin:10px 0 10px 0;width:585px;">
      <tr>
        <td style="padding:0;margin:0;border-bottom:1px solid #a32e05;">
          <div id="desctab" onclick="changeTab('desc');" style="border:1px solid #a32e05;border-bottom:0;color:#eef2ee;background:#a32e05;float:left;margin:0 3px 0 0;padding:2px 6px 2px 6px;font-weight:bold;">Description</div>
          <div id="hightab" onclick="changeTab('high');" style="border:1px solid #a32e05;border-bottom:0;cursor:pointer;color:#a32e05;background:#b4c9d0;float:left;margin:0 3px 0 0;padding:2px 6px 2px 6px;font-weight:bold;">Highlights</div>
          <div id="testtab" onclick="changeTab('test');" style="border:1px solid #a32e05;border-bottom:0;cursor:pointer;color:#a32e05;background:#b4c9d0;float:left;margin:0 3px 0 0;padding:2px 6px 2px 6px;font-weight:bold;">Testimonials</div>
          <div id="volutab" onclick="changeTab('volu');" style="border:1px solid #a32e05;border-bottom:0;cursor:pointer;color:#a32e05;background:#b4c9d0;float:left;margin:0 3px 0 0;padding:2px 6px 2px 6px;font-weight:bold;">Volunteer</div>
        </td>      
      </tr>
    </table>  
      
          
    <div id="desc" style="border:0px solid red;width:585px;">
    <!-- Course Dates -->
      
    <table cellpadding="0" cellspacing="0" border="0" width="585" style=""><tr><td>
        
    <div style="width:585px;border:0px solid red;">
      
    <!-- course picture -->
    <xsl:value-of select="umbraco.library:RenderMacroContent(concat('&lt;?UMBRACO_MACRO macroAlias=&quot;CoursePicture&quot; source=&quot;', $source, '&quot; runat=&quot;server&quot; /&gt;'), $currentPage/@id)" disable-output-escaping="yes" />

    <div style="float:right;width:420px;">
      
    <!-- course dates -->
    <xsl:value-of select="umbraco.library:RenderMacroContent(concat('&lt;?UMBRACO_MACRO macroAlias=&quot;CourseDates&quot; source=&quot;', $source, '&quot; runat=&quot;server&quot; /&gt;'), $currentPage/@id)" disable-output-escaping="yes" />

    <!-- courese long desc -->
    <xsl:value-of select="umbraco.library:RenderMacroContent(concat('&lt;?UMBRACO_MACRO macroAlias=&quot;CourseLongDesc&quot; source=&quot;', $source, '&quot; runat=&quot;server&quot; /&gt;'), $currentPage/@id)" disable-output-escaping="yes" />
    </div>
    <div class="clear"></div>
    </div>
    <!-- course body -->
    <xsl:value-of select="umbraco.library:RenderMacroContent(concat('&lt;?UMBRACO_MACRO macroAlias=&quot;CourseBody&quot; source=&quot;', $source, '&quot; runat=&quot;server&quot; /&gt;'), $currentPage/@id)" disable-output-escaping="yes" />
      </td></tr></table>
      
     
    </div>  
      
    <div id="high" style="display:none;border:1px solid red;width:585px;">
    highlights
    </div>  
      
    <div id="test" style="display:none;border:1px solid red;width:585px;">
    testimonials
    </div>  
      
    <div id="volu" style="display:none;border:1px solid red;width:585px;">
    volunteers
    </div>  
     
    <xsl:value-of select="aboutGrandfatherImage" disable-output-escaping="yes"/>
      
    </xsl:template>

    </xsl:stylesheet>

    One more thing (and I don't know if this is relevant, but in case it is). The page displayed in the in the browser is /dispcourse.aspx?course=standard. It has a single richt text field to house the macro that puts everything together. It's called 'Course Page.' This macro has many different componets that live in their separate macros. I haven't run into any problems so far, because in these (let's call them) sub macros everything is hard coded. Now I'm in the process of using information from the query string and logic to put the contents of the page together dynamically. For instance, 'course=standard' will need to have a different title from 'course=advanced-standard'. I sure hope this makes sense.

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Sep 09, 2012 @ 21:31
    Chriztian Steinmeier
    0

    Hi Kory,

    The reason your value-of doesn't output anything has to do with the XML context - I made a Gist once to explain something very similar: https://gist.github.com/871656

    Ususally, you just want to take the field from the current page, e.g.: $currentPage/aboutGrandfatherImage

    /Chriztian

Please Sign in or register to post replies

Write your reply to:

Draft