We describe an algorithm for constructing fractal molecular clouds that obeys prescribed mass and velocity scaling relations.The algorithm involves a random seed, so that many different realisations corresponding to the same fractal dimension and the same scaling relations can be generated. It first generates all the details of the density field, and then position the SPH particles, so that the same simulation can be repeated with different numbers of particles to explore convergence. It can also be used to initialise finite-difference simulations. We then present preliminary numerical simulations of Hii regions expanding into such clouds, and explore the resulting patterns of star formation. If the cloud has low fractal dimension, it already contains many small self-gravitating condensations, and the principal mechanism of star formation is radiatively driven implosion. This results in star formation occurring quite early, throughout the cloud. The stars resulting from the collapse and fragmentation of a single condensation are often distributed in a filament pointing radially away from the source of ionising radiation; as the remainder of the condensation is dispersed, these stars tend to get left behind in the Hii region. If the cloud has high fractal dimension, the cloud does not initially contain dense condensations, and star formation is therefore delayed until the expanding Hii region has swept up a sufficiently massive shell. The shell then becomes gravitationally unstable and breaks up into protostars. In this collect-and-collapse mode, the protostars are distributed in tangential arcs, they tend to be somewhat more massive, and as the expansion of the shell stalls they move ahead of the ionisation front.