ASPX templates
Version 7.x > ASPX templates > How to make an empty transformation View modes: 
User avatar
Member
Member
shauna.gordon-fahlgren - 12/20/2012 10:34:34 AM
   
How to make an empty transformation
This KB article mentions that the separator transformation needs to be empty in order to break out of the hierarchy.

How do I make a blank separator transformation?

I've tried not selecting a transformation name, but when I save the Separator Transformation, I get an error that the transformation can't be empty. When I create a transformation and try to either save it without anything, or save it with just whitespace (I've used both a space and a newline, both fail), it says that the transformation must have some kind of content.

User avatar
Member
Member
shauna.gordon-fahlgren - 12/20/2012 10:37:54 AM
   
RE:How to make an empty transformation
I've worked around this by adding a code comment, such as
<%# /* Empty separator. */ %>
but it seems this should either be mentioned in the KB article, or creating an actually empty transformation should be allowed.

User avatar
Member
Member
shauna.gordon-fahlgren - 12/20/2012 10:39:56 AM
   
RE:How to make an empty transformation
shauna.gordon-fahlgren wrote: I've worked around this by adding a code comment, such as
<%# /* Empty separator. */ %>
but it seems this should either be mentioned in the KB article, or creating an actually empty transformation should be allowed.

Correction, that results in the following error:
[CMSDataProperties.LoadTransformation]: http://server/CMSVirtualFiles/Transformations/=vg=07d93b36-810a-4d74-80a5-94c7e8f79efa/My.Separator.ascx(2): error CS0839: Argument missing

User avatar
Certified Developer 13
Certified Developer 13
kentico-jx2tech - 12/20/2012 11:08:27 AM
   
RE:How to make an empty transformation
try:
<% // Empty separator. %>

User avatar
Member
Member
shauna.gordon-fahlgren - 12/20/2012 11:13:50 AM
   
RE:How to make an empty transformation
kentico-jx2tech wrote: try:
<% // Empty separator. %>

I've actually already worked around it by just sticking in an empty span (and have actually repurposed it for image sliders). My point is, though, is that there isn't any indication that you have to put in a comment block (for the record, even an HTML comment doesn't work, it returns the same error) or some kind of empty element in order to make an "empty" transformation.

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 12/23/2012 10:13:50 AM
   
RE:How to make an empty transformation
Hi,

could you please try to insert following code to the transformation (without additional space)?
& nbsp;

Best regards,
Ivana Tomanickova

User avatar
Member
Member
vcarter - 4/18/2013 9:33:49 AM
   
RE:How to make an empty transformation
$nbsp seemed to add a bunch of extra space to my menu, I used ­ instead. However this still feels like a clunky solution.

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 4/18/2013 10:07:04 PM
   
RE:How to make an empty transformation
Hello,

try to use the following transformation - invisible byte order mark:
<%&#xFEFF%>

Best regards,
Martin Danko

User avatar
Member
Member
vcarter - 4/19/2013 9:06:28 AM
   
RE:How to make an empty transformation
Thank you, that worked perfectly.

User avatar
Member
Member
vcarter - 8/5/2013 8:29:18 AM
   
RE:How to make an empty transformation
Just a heads up. This expression causes the following error.
Error while evaluating expression: &#xFEFF
[MacroElement.ParseNext]: Unable to process the element '&#'<- on index 1 (ErrorUnknown)
at CMS.GlobalHelper.MacroElement.ParseNext(String expression, Int32& index, Boolean supressError, Boolean isParamValue)
at CMS.GlobalHelper.MacroElement.ParseExpression(String expression, Boolean supressError)
at CMS.GlobalHelper.MacroResolver.ResolveDataMacro(String expression, Object& result, Boolean& match, Boolean keepObjectsAsResult, Boolean& securityCheckPassed, Boolean& doNotResolve, Boolean skipSecurityCheck)

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 8/5/2013 10:11:31 AM
   
RE:How to make an empty transformation
Hello,

Where exactly are you using it and what is the type of transformation?

Regards,
Martin Danko

User avatar
Member
Member
vcarter - 8/5/2013 10:35:22 AM
   
RE:How to make an empty transformation
Hello Martin, thanks for responding:

I am fully open to the possibility that I set up my transformation incorrectly.

I have several hierarchical transformations for menu items:

Primary Navigation
Sub Navigation
Site Map

They are all basically structured the same. The only place the "blank" code was being used was on specific levels separator transformation. I guess this is needed to break the hierarchy so that the list/sublists can repeat.

Level 0 Head - Text/XML
<ul>

Level 0 Item - ASCX
<li<%# IfCompare(CMS.CMSHelper.CMSContext.CurrentDocument.NodeAliasPath.StartsWith(Eval("NodeAliasPath").ToString()).ToString(), "True", "", " class='down'") %>><a href="<%# IfEmpty(Eval("DocumentMenuRedirectUrl"),GetDocumentUrl(),Eval("DocumentMenuRedirectUrl")) %>" <%# IfEmpty(Eval("DocumentMenuJavascript"),""," onclick=\""+Eval("DocumentMenuJavascript")+"\"") %>><%# IfEmpty(Eval("DocumentMenuCaption"),Eval("DocumentName"),Eval("DocumentMenuCaption")) %></a>

Level 0 Separator - Text/XML
</li>

Level 0 Current- ASCX
<li class="down"><a href="<%# IfEmpty(Eval("DocumentMenuRedirectUrl"),GetDocumentUrl(),Eval("DocumentMenuRedirectUrl")) %>" <%# IfEmpty(Eval("DocumentMenuJavascript"),""," onclick=\""+Eval("DocumentMenuJavascript")+"\"") %>><%# IfEmpty(Eval("DocumentMenuCaption"),Eval("DocumentName"),Eval("DocumentMenuCaption")) %></a>

Level 0 Foot - Text/XML
  </li>
</ul>

Level 1 Head - Text/XML
<ul>

Level 1 Item - ASCX
<li><a href="<%# IfEmpty(Eval("DocumentMenuRedirectUrl"),GetDocumentUrl(),Eval("DocumentMenuRedirectUrl")) %>" <%# IfEmpty(Eval("DocumentMenuJavascript"),""," onclick=\""+Eval("DocumentMenuJavascript")+"\"") %>><%# IfEmpty(Eval("DocumentMenuCaption"),Eval("DocumentName"),Eval("DocumentMenuCaption")) %></a></li>

Level 1 Separator - Text/XML (This is where I had been using {%&#xFEFF%})
­

Level 1 Current - ASCX
<li><a href="<%# IfEmpty(Eval("DocumentMenuRedirectUrl"),GetDocumentUrl(),Eval("DocumentMenuRedirectUrl")) %>" <%# IfEmpty(Eval("DocumentMenuJavascript"),""," onclick=\""+Eval("DocumentMenuJavascript")+"\"") %>><%# IfEmpty(Eval("DocumentMenuCaption"),Eval("DocumentName"),Eval("DocumentMenuCaption")) %></a></li>

Level 1 Foot - Text/XML
</ul>

This generates my main navigation with a drop down for 1st tier sub items. Does that info help?

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 8/7/2013 6:42:29 PM
   
RE:How to make an empty transformation
Hi,

So this solution doesn't work in the hierarchical transformation where you are combining different types of transformations. You can try to insert some kind of empty HTML element, e.g. SPAN or DIV with 0 height and 0 width properties.

Best Regards,
Martin Danko

User avatar
Member
Member
vcarter - 8/8/2013 9:32:40 AM
   
RE:How to make an empty transformation
Yeah, I ended up using the soft hyphen character(since it is invisible). I wanted to limit the amount of extra markup.

Thank you very much for your help. Just wanted to give people a heads up.

User avatar
Member
Member
vcarter - 8/13/2013 11:38:07 AM
   
RE:How to make an empty transformation
Just an update, the soft hyphen & shy ; does not display properly in IE, will most like end up using an empty span.