Rendering the Rich Text field that contains a hyperlink might fail with the following error:
ERROR A rendering error occurred: Xsl file could not be processed (details: System.Xml.Xsl.XslTransformException: An error occurred during a call to extension function 'field'. See InnerException for a complete description of the error. ---> System.ArgumentOutOfRangeException: Length cannot be less than zero. Parameter name: length at System.String.Substring(Int32 startIndex, Int32 length) at Sitecore.Pipelines.RenderField.SetAnchorsPositionInLinks.CheckLinks(String text) at Sitecore.Pipelines.RenderField.SetAnchorsPositionInLinks.Process(RenderFieldArgs args) at (Object , Object ) at Sitecore.Pipelines.PipelineMethod.Invoke(Object argument) at Sitecore.Pipelines.CoreProcessor.Invoke(Object argument) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args) at Sitecore.Pipelines.CorePipeline.Run(String pipelineName, PipelineArgs args) at Sitecore.Web.UI.WebControls.FieldRenderer.RenderField() at Sitecore.Web.UI.WebControls.FieldRenderer.Render() at Sitecore.Xml.Xsl.XslHelper.field(String fieldName, XPathNodeIterator iterator, String parameters) --- End of inner exception stack trace --- at System.Xml.Xsl.Runtime.XmlExtensionFunction.Invoke(Object extObj, Object[] args) at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args) at <xsl:template match="*">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current) at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer) at Mvp.Xml.Common.Xsl.MvpXslTransform.TransformToWriter(XmlInput defaultDocument, XsltArgumentList xsltArgs, XmlWriter targetWriter) at Mvp.Xml.Common.Xsl.MvpXslTransform.Transform(XmlInput input, XsltArgumentList arguments, XmlOutput output) at Sitecore.Web.UI.WebControls.XslFile.DoRender(HtmlTextWriter output, Item item))
The issue occurs if the href attribute of the link has no value:
<a href="">linktext</a>
To resolve the issue, consider one of the following options: