A man copied the storyline of a pornographic story he read on the internet when he attempted to rape a 17-year-old, the Old Bailey has heard.
The teenager was stabbed in the neck and stomach during the attack in Priory Gardens, Orpington, south-east London.
She was saved by surgeons after a passer-by rescued her, the court heard.
Hospital care assistant Peter Anscombe, 28, of Orpington, denies attempted murder, attempted rape, sexual assault and causing grievous bodily harm.
'Sexually motivated'
He also denies assault with intent to commit a sexual offence on another woman.
Christopher Hehir, prosecuting, said the 17-year-old, who cannot be named, was attacked on 30 September last year after she got off a bus and took a shortcut through Priory Gardens on her way to work as a shop assistant.
It is alleged that Mr Anscombe told the victim not to scream, then stabbed her in her stomach.
He then sexually assaulted her before stabbing her in the neck, said Mr Hehir.
The victim told the police the man used the knife to cut off her bra and clothing and fondled her breasts.
The attack was interrupted by a female passer-by who tried to follow the man before returning to the victim and calling for help.
'Scientific evidence'
The victim was taken to Queen Mary's Hospital in Sidcup, where Mr Anscombe worked, and she underwent emergency surgery.
Mr Hehir told the court that she would have died without expert medical care.
Following his arrest, three computers belonging to Mr Anscombe were found to contain a number of stories and images of rape and sexual violence, the court was told.
In one of the stories, "Steve's next victim", "Steve" rapes a 16-year-old blonde girl in a field which she uses as a short-cut on her way home from work, after threatening her with a knife.
A knife was later found in a pond at the park with the victim's blood on it.
Four days earlier Mr Anscombe attacked a 39-year-old housewife in a car park in nearby Bromley, the court heard, but ran off when a witness sounded her car horn.
"Prior to these events, he (Peter Anscombe) had led an apparently blameless life," said Mr Hehir.
"However, whatever the outward appearances, he is in fact a man with a long-standing and sinister interest in sexual violence against women."
CCTV images
He told the jury that the victims were both blonde and attractive and each attack was sexually motivated.
Mr Anscombe was caught on closed circuit television at or close to the scene.
He admitted being at the scenes but said it was a coincidence, Mr Hehir said.
He also told the court that both victims had identified Mr Anscombe from videos and scientific evidence from the attack on the 17-year-old had linked him to the assault.
The victims cannot be named for legal reasons.
The trial was adjourned until Tuesday.