Solitary wave transformation in a zone with a sign-variable coefficient for the quadratic nonlinear term is studied in the framework of the variable-coefficient extended Korteweg–de Vries equation. This situation can be realised for internal waves in a stratified ocean, when the pycnocline lies midway between the sea bed and the sea surface. The effects of the cases when the coefficient of the cubic nonlinear term can be either positive or negative are investigated. For small-amplitude solitary waves, previous results (when the cubic nonlinear term is ignored) are confirmed; the initial solitary wave is destroyed, and solitary waves of the opposite polarity are generated after passage through the turning point (i.e. the location where the coefficient of the quadratic nonlinear term is zero). For large-amplitude solitary waves the cubic nonlinear term, and particularly its sign, influence significantly both the polarity and amplitude of the resulting solitary waves. If the cubic nonlinear term has a negative coefficient, the amplitude of the ‘large’ terminal wave is comparable with the initial value (it is less than 50% when the cubic nonlinear term is ignored). If the cubic nonlinear term has a positive coefficient, the result depends on the initial wave amplitude. Large-amplitude solitary waves pass through the transition zone keeping the solitary wave shape and its polarity. Moderate-amplitude solitary wave are destroyed and transformed to a strongly pulsating wave packet (breather).