private void CheckContentStart() { if (_redirectState == RedirectState.WritingRedirectElementAttrs) { //Check required href attribute if (_state.Href == null) { throw new ArgumentNullException("", @"'href' attribute of exsl:document element must be specified."); } //Are we writing to this URI already? if (_states.Cast <OutputState>().Any(nestedState => nestedState.Href == _state.Href)) { throw new ArgumentException("Cannot write to " + _state.Href + " two documents simultaneously."); } _state.InitWriter(_outResolver); _redirectState = RedirectState.Redirecting; } }