The pattern of natural vegetation on non-calcareous soils in two deep river valleys of the Bohemian Massif (Vltava and Dyje rivers, Czech Republic) was analyzed in order to determine the main topographic and soil variables affecting the composition of the vegetation. Vegetation data together with topographic and soil variables were collected along transects down the slope from the upper edge to the bottom of the valley. The distribution of vegetation types within the valleys was described using cluster analysis and non-metric multidimensional scaling (NMDS). Effects of topographic and soil variables were compared using a set of canonical correspondence analyses (CCAs) with explanatory variable selection based on the Akaike information criterion (AIC). In order to describe the non-linear interaction between the two topographic variables, elevation and aspect, a new method (moving window CCA) was introduced. This method assessed the explanatory power of aspect at various elevations above the valley bottom. Results show that main vegetation coenoclines are correlated with two complex environmental gradients: the moisture-nutrient-soil reaction and light-temperature-continentality gradients. Soil variables are slightly better predictors of vegetation composition than topographic variables. Altogether, these variables explain 18.8–21.6% of the total inertia. Although soil development depends on topography, the variation jointly explained by both groups of variables is only 3.9–5.2%, indicating that each of these two groups of variables influences vegetation pattern in a different way. Variables selected by the most parsimonious model for the Vltava valley are aspect, soil pH, soil type fluvisol and soil depth. For the Dyje valley the same variables as in Vltava valley were selected except for soil depth, which was replaced by soil type cambisol. Aspect has a strong effect on vegetation on the middle slopes but not on the lower slopes of the valleys. The results of all analyses are similar between the two valleys, suggesting that similar patterns may also occur in other deep river valleys of mid-altitudes of the Bohemian Massif.