In this paper, the tracking problem involving nonperiodic tracking-transition switching is considered from a learning-based decomposition viewpoint. Non-periodic tracking-transition occurs in applications where precision tracking of a given desired trajectory in sections is intermediated to rapid transition of the output with given boundary conditions. The control challenges arise as the tracking and the transition sections are coupled together, post-switching oscillations of the output can be induced due to the mismatch of the boundary states, and the tracking performance can be limited by the nonminimum-phase zeros. Although these challenges have been tackled recently by combining the system-inversion with optimization technique, the solution obtained involves heavy online computation, and can be sensitive to model uncertainties. This work aims to overcome these limitations through a learning-based decomposition approach, where a library of input-output elements is constructed offline via iterative learning a priori, and then used online to both decompose the desired output (in tracking sections), design and optimize the desired transition output (in transition sections), and synthesize the control input based on the superposition principle. The proposed approach is demonstrated through experiment implementation on a piezoelectric actuator.