Copied to clipboard

Flag this post as spam?

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


  • Brian Milman-Hurst 48 posts 76 karma points
    Jul 20, 2012 @ 17:23
    Brian Milman-Hurst
    0

    Need help with creating an XSLT to reference a different node

    Hi guys,

     

    I'm really new tio Umbraco (like this week new!) and I'm getting to grips with it slowly but need some help with an XSLT please.

    The purpose is to create a list of news articles (entered against the News Area parent node) but I want the list to show in a different node all together (the main clients page).  I have used the following (with 1094 being the node of the News parent node) but all that displays on my client page is "Error loading MacroEngine script (file: )".

    I admit to copying the XSLT from a similar function that I found on the Forum and then replaced the node number, but this obviously hasn't fixed it..

    Here is my code:

    <?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" exclude-result-prefixes="msxml umbraco.library">
    <xsl:output encoding="utf-8" indent="yes" method="xml" omit-xml-declaration="yes" />
    <xsl:param name="currentPage"/>
    <xsl:template match="/">

      <xsl:variable name="parentNode" select="umbraco.library:GetXmlNodeById(1094)"/>
     <ul>
      <xsl:apply-templates select="$parentNode/node[string(data[@alias='umbracoNaviHide']) != '0']">
       <xsl:sort select="@nodeName" data-type="text" order="descending" />
      </xsl:apply-templates>
     </ul>
    </xsl:template>
    <xsl:template match="node">
     <li>
      <a href="{umbraco.library:NiceUrl(@id)}">
      <!-- check if the node has the 'linkText' set, otherwise fallback on the 'nodeName' -->
      <xsl:choose>
       <xsl:when test="string-length(data[@alias='linkText']) &gt; 0">
        <xsl:value-of select="data[@alias='linkText']" />
       </xsl:when>
       <xsl:otherwise>
        <xsl:value-of select="@nodeName" />
       </xsl:otherwise>
      </xsl:choose>
      </a>
      <!-- check if the node has any children (that are not hidden from nav) -->
      <xsl:if test="count(node[string(data[@alias='umbracoNaviHide']) != '1']) &gt; 0">
       <ul>
       <!-- apply the templates for the sub-child nodes -->
       <xsl:apply-templates select="node[string(data[@alias='umbracoNaviHide']) != '1']">
        <xsl:sort select="@nodeName" data-type="text" order="ascending" />
       </xsl:apply-templates>
       </ul>
      </xsl:if>
     </li>
    </xsl:template>
    </xsl:stylesheet>

     

    Any help would be greatly appreciated.

    Cheers

    Brian

  • Brendan Rice 538 posts 1100 karma points
    Jul 20, 2012 @ 21:41
    Brendan Rice
    0

    Hi Brian,

    I can't see the error off hand a good think to do would be to enable umbraco debug mode and look for the error that is getting generated, here is how to turn on debug mode:

    1. Make sure debug is enabled in your web.config app setting (umbraco debug or something)

    2. Follow the instructions here - http://our.umbraco.org/wiki/how-tos/

    That should be it.

    Hope it helps.

    B

Please Sign in or register to post replies

Write your reply to:

Draft