Transformer.NET.Token.ApplyTemplate C# (CSharp) Method

ApplyTemplate() public method

public ApplyTemplate ( TemplateTag tpl ) : string
tpl TemplateTag
return string
        public virtual string ApplyTemplate(TemplateTag tpl)
        {
            string output;
            if (this.Selector != null && this.Selector.Length > 0)
            {
                TokenSelector selector = TokenSelector.ToTokenSelector(this.Transformer, this.Selector);
                List<string> list = selector.Matches(this.Transformer.Text, this);

                StringBuilder sb = new StringBuilder();
                foreach (string match in list)
                {
                    if (match != null && match.Length > 0)
                    {
                        sb.Append(tpl.Apply(match));
                    }
                }
                return sb.ToString();
            }
            
            output = this.ManagedTokensToString();
            return tpl.Apply(output != null && output.Length > 0 ? output : this.Value);
        }