take into account the outdir document attribute if specified
Merge pull request #31 from neher/issue30

Take into account the outdir document attribute if specified