Structured Document Tags
The final example of customer-defined semantics which can be embedded in a WordprocessingML document is the structured document tag (SDT).
As shown above, smart tags and custom XML markup each provide a facility for embedding customer-defined semantics into the document: smart tags, via the ability to provide a basic namespace/name for a run or set of runs within a documents; and custom XML markup, via the ability to tag the document with XML elements and attributes specified by any valid XML Schema file.
However, each of these techniques, while they each provide a way to add the desired semantic information, does not provide a way to affect the presentation or interaction within the document. To bridge these two worlds, structured document tags allow both the specification of customer semantics as well as the ability to influence the presentation of that data in the document.
This means that the customer can define the semantics and context of the tag, but can then use a rich set of pre-defined properties to define its behavior and appearance within the WordprocessingML document's presentation.
Consider a region which should be tagged with the semantic of "birthday", for the user to enter their date or birth into the document. Ideally, this region would also utilize a date picker to allow the user to enter the date from a calendar::
This content would translate to the following WordprocessingML markup:
<w:sdt> <w:sdtPr> <w:alias w:val="Birthday"/> <w:id w:val="8775518"/> <w:placeholder> <w:docPart w:val="DefaultPlaceholder_22479095"/> </w:placeholder> <w:showingPlcHdr/> <w:date> <w:dateFormat w:val="M/d/yyyy"/> <w:lid w:val="EN-US"/> </w:date> </w:sdtPr> <w:sdtContent> <w:p> <w:r> <w:rPr> <w:rStyle w:val="PlaceholderText"/> </w:rPr> <w:t>Click here to enter a date...</w:t> </w:r> </w:p> </w:sdtContent> </w:sdt>
As shown above, each of the structured document tags in the WordprocessingML file is represented using the <sdt>
element.
Within a structured document tag, there are two child elements which contain the definition and the content of this SDT. The first of these is the <sdtPr>
element, which contains the set of properties specified for this structured document tag. The second is the <sdtContent>
element, which contains all the content which is contained within this structured document tag.