I have a simple XSLT macro which just outputs a line of text (trying to go for a simple test case to prove my problem).
The macro has use in Editor selected. I can insert the macro in to a RTE field on a node, add parameters to it, and it gets inserted into the RTE and the line of text renders in the RTE.
When I publish the page the macro doesn't seem to execute at all what gets output to the page when it's executed is
That looks like version 3 macro code, which is strange. Try popping it straight into your template using the code above and see what you get, then try this in your template
It looks like you're somehow getting v3 macro code, which would explain why it's not being rendered properly. Not sure why though.. was this site an upgrade or a fresh install?
I meant you could put the two types of macro code straight into the template (copy & pasting from the forum) and see which one renders content, but that doesn't solve the problem.
Arrgh. I just ran up against this today with a live client site. it seems to only appear when rendering a RTE field via xslt and disable-output-escaping. changing to just using a page field fixed it. ie using
Dan -- That's a good workaround but is no good for me. I've got other stuff in the XSLT macro doing stuff that can't be done in a template. I'll update the bug in codeplex with your findings.
I'd need to find a repeatable case, cos the bug didnt appear for all my macros (just the most important one... go figure) when all were rendered via xslt. There must be something in the particular macros that cause the issue, and finding a clear test case would speed up the patch process
I don't know if this solves your issue, but when I have macros that are to be inserted in the RTE, any parameter names must be in all lowercase, since Tidy will change all your attributes to lowercase to conform to xhtml.
As I said, I have no idea if this relates to your problem, but it's one of those "good to know" things.
Then insert a macro (hello) in the editor and add a parameter (value: "Value setting in the editor") to it. The marco gets inserted into the RTE and the line of text renders in the RTE as:
10/15/2009 4:23:49 PM Value setting in the editor.
When I publish the page the macro outputs only static content ("Hello World !") and seems Page_Load() didn't excute at all.
Macro hello:
<%@ Control Language="C#" AutoEventWireup="true" %>
<script runat="server"> private string _name; public string name { get { return _name;} set { _name = value; } } protected void Page_Load(object sender, EventArgs e) { Label1.Text = DateTime.Now.ToString() + "<br />" + name ; } </script> <asp:Label ID="Label1" runat="server" Text="Hello World !"></asp:Label>
Macro Rendering in RTE but not in Site
I have a simple XSLT macro which just outputs a line of text (trying to go for a simple test case to prove my problem).
The macro has use in Editor selected. I can insert the macro in to a RTE field on a node, add parameters to it, and it gets inserted into the RTE and the line of text renders in the RTE.
When I publish the page the macro doesn't seem to execute at all what gets output to the page when it's executed is
Which obviously isn't right.
Running Umbraco 4.0.1.2 on Win2003 Web Edition, ASP.net 2.0.50727.
That looks like version 3 macro code, which is strange. Try popping it straight into your template using the code above and see what you get, then try this in your template
It looks like you're somehow getting v3 macro code, which would explain why it's not being rendered properly. Not sure why though.. was this site an upgrade or a fresh install?
Dan
Pretty certain it was a fresh install of v4.0.1.2. Very strange.
Anyway I can't paste that straight in, as I'm inserting the macro in the RTE. In the Editor source code I see
What's being output to the browser is
<?UMBRACO_MACRO numbertolist="3"
macroAlias="LatestCountryLinks" source="1347" />
So the upshot is, I can't insert your macro code into the RTE because TinyMCE or Tidy is stripping it out.
I meant you could put the two types of macro code straight into the template (copy & pasting from the forum) and see which one renders content, but that doesn't solve the problem.
A quick dig on this reveals http://umbraco.codeplex.com/WorkItem/View.aspx?WorkItemId=21728 and http://forum.umbraco.org/yaf_postst8677_XSLT-Macro-not-rendering-to-page.aspx, but unfortunately it looks like there isn't currently a solution.
Hi Paul!
What do you use for rendering your RTE-field? Do ypu use XSLT to render the field, or how do you do it?
Kim the field is being output from an XSLT macro which is called from the template.
Arrgh. I just ran up against this today with a live client site. it seems to only appear when rendering a RTE field via xslt and disable-output-escaping. changing to just using a page field fixed it. ie using
In the template, instead of
In an xslt macro
Hope this helps,
Dan
Dan -- That's a good workaround but is no good for me. I've got other stuff in the XSLT macro doing stuff that can't be done in a template. I'll update the bug in codeplex with your findings.
P
I'd need to find a repeatable case, cos the bug didnt appear for all my macros (just the most important one... go figure) when all were rendered via xslt. There must be something in the particular macros that cause the issue, and finding a clear test case would speed up the patch process
Paul.
I have used this in earlier projects to render macroes in the RTE through XSLT:
This will show the macro (and the rest of the content in the RTE of course ;) ) on the frontend, and is rendered through XSLT. Try it out :)
I don't know if this solves your issue, but when I have macros that are to be inserted in the RTE, any parameter names must be in all lowercase, since Tidy will change all your attributes to lowercase to conform to xhtml.
As I said, I have no idea if this relates to your problem, but it's one of those "good to know" things.
//S
Stephan - thanks for the advice but all attributes are lowercase already.
Did you try out the:
umbraco.library:RenderMacroContent
Paul?
I have the same problem.
I tried:
<xsl:variable name="content" select="$currentPage/data [@alias='pageBody']" />
<xsl:value-of select="umbraco.library:RenderMacroContent($content, $currentPage/@id)" disable-output-escaping="yes"/>
Then insert a macro (hello) in the editor and add a parameter (value: "Value setting in the editor") to it. The marco gets inserted into the RTE and the line of text renders in the RTE as:
Value setting in the editor.
When I publish the page the macro outputs only static content ("Hello World !") and seems Page_Load() didn't excute at all.
Macro hello:
<%@ Control Language="C#" AutoEventWireup="true" %>
<script runat="server">
private string _name;
public string name
{
get { return _name;}
set { _name = value; }
}
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToString() + "<br />" + name ;
}
</script>
<asp:Label ID="Label1" runat="server" Text="Hello World !"></asp:Label>
i dont think you can fire .net usercontrols in a xslt rendering
inline c#, and xslt extensions, but not usercontrols.
It seems fire when i take a look on trace:
macroAlias="Hello" />
is working on a reply...