Copied to clipboard

Flag this post as spam?

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


  • curlybub 133 posts 107 karma points
    Mar 08, 2010 @ 04:40
    curlybub
    0

    Wrapping a user control inside a xslt condition

    Hi,

    I'm trying to restrict posting comments on blog for umbraco by using xslt to check if the user is logged in or not. Inside the xslt if condition i inserted the umbraco macro for posting comments on the blog. I received an error that says.

    Error occured

    System.Xml.XmlException: 'umbraco' is an undeclared namespace. Line 24, position 4.
    at System.Xml.XmlTextReaderImpl.Throw(Exception e)
    at System.Xml.XmlTextReaderImpl.Throw(String res, String arg, Int32 lineNo, Int32 linePos)
    at System.Xml.XmlTextReaderImpl.LookupNamespace(NodeData node)
    at System.Xml.XmlTextReaderImpl.ElementNamespaceLookup()
    at System.Xml.XmlTextReaderImpl.ParseAttributes()
    at System.Xml.XmlTextReaderImpl.ParseElement()
    at System.Xml.XmlTextReaderImpl.ParseElementContent()
    at System.Xml.XmlTextReaderImpl.Read()
    at System.Xml.Xsl.Xslt.XsltInput.ReadNextSiblingHelper()
    at System.Xml.Xsl.Xslt.XsltInput.ReadNextSibling()
    at System.Xml.Xsl.Xslt.XsltInput.MoveToNextSibling()
    at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, InstructionFlags flags)
    at System.Xml.Xsl.Xslt.XsltLoader.XslIf()
    at System.Xml.Xsl.Xslt.XsltLoader.XslChoose()
    at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, InstructionFlags flags)
    at System.Xml.Xsl.Xslt.XsltLoader.LoadTemplate(NsDecl stylesheetNsList)
    at System.Xml.Xsl.Xslt.XsltLoader.LoadRealStylesheet()
    at System.Xml.Xsl.Xslt.XsltLoader.LoadDocument()
    at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)

    Here is my xslt file. 

     

    <?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:MailEngine="urn:MailEngine" xmlns:pdcalendar="urn:pdcalendar" xmlns:Designit.VideoEmbed="urn:Designit.VideoEmbed" 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 MailEngine pdcalendar Designit.VideoEmbed tagsLib BlogLibrary ">

     


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

    <xsl:param name="currentPage"/>

    <xsl:template match="/">
    <xsl:variable name="loggedOutTemplate" select="2388" />

    <xsl:variable name="currentId" select="$currentPage/@id" />       
    <xsl:choose>               
     <xsl:when test="umbraco.library:IsLoggedOn()">                       
      <!-- <xsl:value-of select="umbraco.library:RenderTemplate($currentId,$loggedInTemplate)" disable-output-escaping="yes" /> -->
      <umbraco:Macro Alias="frmBlogComment" runat="server"></umbraco:Macro>                
     </xsl:when>               
     <xsl:otherwise>                       
      <xsl:value-of select="umbraco.library:RenderTemplate($currentId,$loggedOutTemplate)" disable-output-escaping="yes" />               
     </xsl:otherwise>       
    </xsl:choose>

    </xsl:template>

    </xsl:stylesheet>

     

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Mar 08, 2010 @ 10:17
    Peter Dijksterhuis
    0

    Hi,

    you cannot use umbraco:Macro directly in xslt, hence the error.

    You can use umbraco.library:RenderMacroContent however. See here for an example:

    http://web-garden.co.uk/2008/7/30/passing-parameters-to-rendermacrocontent.aspx

    HTH,

    Peter

  • curlybub 133 posts 107 karma points
    Mar 08, 2010 @ 14:06
    curlybub
    0

    Hi Peter,

    Thank you. I'll try your suggestion. BTW, I was wondering where to get the Template ID number. Like the one on this "2388" Sorry, I know very very little in .net and xslt, im more on the designing part.

    <xsl:variable name="loggedOutTemplate" select="2388" />
  • Peter Dijksterhuis 1442 posts 1722 karma points
    Mar 08, 2010 @ 14:30
    Peter Dijksterhuis
    0

    Goto the developer-section in umbraco. Then goto the templates-tree. If you hover your mouse over the template in the tree (on the left-side), then you'll see the template-number appearing in your browsers status-bar at the bottom.

    HTH,

    Peter

  • curlybub 133 posts 107 karma points
    Mar 08, 2010 @ 14:42
    curlybub
    0

    Thank you so much Peter! :D

Please Sign in or register to post replies

Write your reply to:

Draft