You're a bit confuzzled about the purpose of a DTD. A DTD describes what a particular (X|SG)ML document will contain, but it's not required to generate a document conforming to that DTD. It's more for use by other tools to determine if a particular well-formed (X|SG)ML document (i.e. one which conforms to the syntax requirements) is a valid document (i.e. has the expected semantic contents and layout).
There are tools (SGML aware editors and the like) which can use a DTD to provide more intelligent editing (perhaps giving dropdown lists for attribute values, for example), but unless you're writing one of those you really just need to understand what the DTD is describing and generate your output according to its expectations.