HL7v3 (CDA) notes
Go to this link, click on the link in the table, Current_Version_Nov 2020,
...which leads you to download a zip. Explode this zip. In the resulting subdirectory you will find file CDAR2_IG_CCDA_CLINNOTES_R1_DSTU2.1_2015AUG_Vol2_2019JUNwith_errata.pdf.
This is what you want; it's a document (Volume 2) entitled HL7 Implementation Guide for CDA® Release 2: Consolidated CDA Templates for Clinical Notes (US Realm) Draft Standard for Trial Use Release 2.1 Draft Standard for Trial Use August 2015 Volume 2—Templates and Supporting Material (CCDA, PDF download).
Note that you probably also want the document (Volume 1) next to the previous one entitled, CDAR2_IG_CCDA_CLINNOTES_R1_DSTU2.1_2015AUG_Vol1_2019JUNwith_errata.pdf.
Note, if you're an implementor, i.e.: you write code calling into the MDHT library (discussed later), that the documents above will work better for you if opened in a browser (rather than in Acrobat or another PDF reader). This has been my (very extensive) experience. I work on Linux. Your mileage may vary.
To generate a CDA (CCD, CCDA, QRDA I, QRDA II, QRDA III, etc.), there is something named an Implementation Guide (downloads or URLs above) that states in three ways what constitutes a section of CDA for each and every resource (patient, enounter, observation, etc.).
The first way is a table that's difficult to read, but quickly searched. It has a column, Verb, with expressions like SHALL, SHOULD, MAY, etc. that are a sort of legalistic pronouncement accompanying cardinality answering the question, do I have to include this, how much do I include or can I just not provide it in the first place?
The second way is a point by point list, more in English, of the same thing. Harder to find stuff in, but a little easier to understand.
The third way is an out and out example of CDA XML that gives easy indication of what should come out from your generation.
Generation is done by the Model-drive Health Tools library (MDHT) written by Sean Muir, Ken Lord and a short list of other guys. It's a bit confusing to constitute the 12-20 JARs (you can't use Maven1) in your project, but support (via the MDHT Skype channel) is very good. See MDHT Notes.
I generally work off the third method and use the other two to resolve questions that arise (like whether or not I have to do something or can get away with not doing it). But, the third way, the example, is more my world. Other people I have worked with tend to look at the first two ways probably because they don't write code to generate, but come from a background of having to read already generated CDA.
1 If getting around this is a problem for you, please consider reading my notes over a period of time beginning at Local-to-project Maven repository and How to create Maven local repositories (faster way), as well as nearby notes, the last one being an even faster way around the problem.
On a sort of related matter, incidentally, HL7v4 (FHIR) has two ways...
First, a very legalistic and somewhat complicated list of what a resource can be composed of. Second, examples that are not too useful—I almost never look at them. They aren't like the examples for HL7v3; they aren't even close to anything that looks like what you'd actually see in the FHIR document (whereas the examples of CDA generated look pretty much exactly as it appears in the document).
For FHIR topics, please see...