"CT" Content Type - 1st "Hop"
"MT" Module Type - 2nd "Hop"
"SH" SiteHTML - 3rd "Hop"
Figure 3.42. Copy Processing, Transformations

Copy Processing, Transformations, with invented (fictitious) elements. (See also the figure for Copy Processing, with just Markup Languages.)
Organized by Type
Markup Languages
BusinessML: ct70_highlight_1abt_i.xml
StructureML: ct70_highlight_1abt_i.xml
StructureLayoutML: ct70_highlight_1abt_i.xml
SiteHTML: ct70_highlight_1abt_i.html
XSLT
ct70_highlight.xslt (and ct00_core.xslt)
mt01.xslt (and mt00_core.xslt)
sh01_general.xslt
EZA ("Element Zone Assignment")
eza-ct70_highlight-mt01-pt70-recipe_1.xml
CSS
ie_pc.css
Organized by Sequence
1st "Hop"
BusinessML: ct70_highlight_1abt_i.xml
ct70_highlight.xslt
eza-ct70_highlight-mt01-pt70-recipe_1.xml
Command line:
java org.apache.xalan.xslt.Process -IN BusinessML/ct70_highlight_1abt_i.xml -XSL xsl/ct70_highlight.xslt -OUT /StructureMLct70_highlight_1abt_i.xml -PARAM mt mt01 -PARAM recipe eza/eza-ct70_highlight-mt01-pt70-recipe_1.xml
<styler> <fileset dir="BusinessML"> <include name="ct70*.xml"/> </fileset> <transform file="xsl/ct70_highlight.xslt"/> <param name="mt" value="mt01"/> <param name="recipe" value="eza-ct70_highlight-mt01-pt70-recipe_1.xml"/> <param name="ct70" value="yes"/> <output dir="StructureML"/> </styler>
2nd Hop
StructureML: ct70_highlight_1abt_i.xml
mt01.xslt and mt00_core.xslt
Command line:
java org.apache.xalan.xslt.Process -IN StructureML/ct70_highlight_1abt_i.xml -XSL xsl/mt01.xslt -OUT /StructureLayoutML/ct70_highlight_1abt_i.xml
Ant /util/build.xml:
<styler> <fileset dir="StructureML"> <include name="ct70*.xml"/> </fileset> <transform file="xsl/mt01.xslt"/> <output dir="StructureLayoutML"/> </styler>
3rd Hop
StructureLayoutML: ct70_highlight_1abt_i.xml
sh01_general.xslt
Command line:
java org.apache.xalan.xslt.Process -IN StructureLayoutML/ct70_highlight_1abt_i.xml -XSL xsl/sh01_general.xslt -OUT /SiteHTML/ct70_highlight_1abt_i.html
Ant /util/build.xml:
<styler> <fileset dir="StructureLayoutML"> <include name="ct*.xml"/> </fileset> <transform file="xsl/sh01_general.xslt"/> <output dir="SiteHTML"> <mapper type="glob" from="*.xml" to="*.html"/> </output> </styler>
Final Result
SiteHTML: ct70_highlight_1abt_i.html
ie_pc.css
BusinessML to StructureML
BusinessML ct70_highlight_1abt_i.xml: <highlights><highlight> <p>Our first marketed product has been making a difference in the lives of patients with cardiovascular disease. <a href="/products/integrilin/index.asp"> More </a> ... </p> </highlight> <highlight> <p>The most advanced of our investigational drugs is being developed with the goal of making a difference in the lives of multiple myeloma patients. <a href="/rd/oncology/velcade/index.asp">More</a>...</p> </highlight> </highlights>
"CT" XSLT = BusinessML to StructureML: ct70_highlight.xslt: <xsl:template match="highlights"><xsl:variable name="eza-info"> <xsl:call-template name="getElementEZA">
<xsl:with-param name="elementName"> <xsl:value-of select="name(.)"/> </xsl:with-param> </xsl:call-template> </xsl:variable> <xsl:copy-of select="$eza-info"/> <div><xsl:apply-templates/></div>
</xsl:template> <xsl:template match="highlight">
<xsl:element name="div"> <xsl:apply-templates/> </xsl:element> </xsl:template>
getElementEZA template (ct00_core.xslt): <xsl:template name="getElementEZA"> <xsl:param name="elementName"/> <!-- TAG NAME --> <xsl:variable name="thisElementName"> <xsl:value-of select="$elementName"/> </xsl:variable> <!-- GET 'EZA' MARKER FOR THIS TAG --> <xsl:for-each select="document($pathPlusRecipe)/ezaRecipe/elementZoneAssignments/eza"><xsl:if test="$thisElementName=@elementName">
<!-- PLANT EZA MARKER --> <xsl:element name="eza"> <xsl:attribute name="zone"><xsl:value-of select="@zone"/></xsl:attribute>
<xsl:attribute name="position"><xsl:value-of select="@position"/></xsl:attribute>
<xsl:if test="@presentationStyle"> <xsl:attribute name="presentationStyle"><xsl:value-of select="@presentationStyle"/></xsl:attribute>
</xsl:if> </xsl:element> </xsl:if> </xsl:for-each> </xsl:template>
| Variables for the "path" plus "Recipe" (filename) have been established, such that the document() function can open the ezaRecipe file. The XPath gets down to the nodeset of individual "assignments" ('eza' element). |
| When the passed-in elementName matches the elementName attribute in the 'eza' element, we've got our match. |
| The "Zone" values match the Module Type cells, and are named simply 'A', 'B', etc. |
| The "Position" value is the numeric position (stacked, top-to-bottom) within a Zone; numbered simply '1', '2', etc. |
| The "Presentation Style" for a particular BusinessML element is often the default "SiteHTML" style as found in the sh01_general.xslt, for the "StructureML" element it is transformed into (e.g. <headline> might become <h3>, or even more generically <div>). But if the presentation needs to differ from the default, a "flag" may be set here in the ezaRecipe file: in this example "ps70" signifies the element <div> will be processed differently. See the sh01_general.xslt snippet below. |
eza-ct70_highlight-mt01-pt70-recipe_1.xml: <ezaRecipe> ... <elementZoneAssignments><eza zone="A" position="1" elementName="highlights" presentationStyle="ps70"/>
</elementZoneAssignments>
| Container for possibly multiple 'eza' elements, one for each "place-able" element in the Content Type Module (BusinessML). In this case, one place-able element only: 'highlights'. | ||||||||
| The key information carried by the ezaRecipe: which Element; which Zone in the Module (which <td> table cell, effectively) (lettered 'A', 'B', etc.); which Position within that Zone (stacked up, simply)(numbered '1', '2', etc.); and (optional) any Presentation Style.
| ||||||||
StructureML to StructureLayoutML
StructureML ct70_highlight_1abt_i.xml: <moduleBody><eza zone="A" position="1" presentationStyle="ps70"/>
<div>
<div><p>Our first marketed product has been making a difference in the lives of patients with cardiovascular disease. <a href="/products/integrilin/index.asp">More</a>...</p></div> <div><p>The most advanced of our investigational drugs is being developed with the goal of making a difference in the lives of multiple myeloma patients. <a href="/rd/oncology/velcade/index.asp">More</a>...</p></div> </div> </moduleBody>
| The container element in BusinessML was 'contentBody'; has now been transformed to 'moduleBody' in StructureML. | ||||||||
| The 'eza' element is written down immediately ahead of the "place-able" element, which was 'highlights' in BusinessML and has been transformed simply to 'div' in StructureML. | ||||||||
| This is the 'div' from the transformation of 'highlights' (plural); it serves as a "wrapping" container element for the entire contents of what was within <highlights> in BusinessML.
(By the way, the next, nested 'div' is unrelated to this "eza" mechanism; it just happens to come from the transformation of the first 'highlight' (singular).)
| ||||||||
"MT" XSLT = StructureML to StructureLayoutML: mt01.xslt (and mt00_core.xslt): mt01.xslt: <table border="0" cellpadding="0" cellspacing="0"> <tr> <td> <div> <xsl:apply-templates select="eza[@zone='A'][@position='1']"/><xsl:apply-templates select="eza[@zone='A'][@position='2']"/> ... <xsl:template match="eza[@zone='A'][@position='1']">
<xsl:call-template name="ezaWriter"/> </xsl:template> mt00_core.xslt: <xsl:template name="ezaWriter">
<xsl:element name="div"> <xsl:copy-of select="following-sibling::*[1]/node()"/>
</xsl:element> </xsl:template>
| All the various MT XSLTs are full of templates that seek to match all the permutations of Zone and Position ('A' '1'; 'A' '2'; etc., 'B' '1'; 'B' '2'; etc.). These are positioned inside <table><tr><td> cells appropriate to the Module Type. |
| The "xsl:apply-templates select" from the above note will "match" this template; it in turn simply calls the 'ezaWriter' template... |
| ezaWriter utility functional template (over in mt00_core.xslt). |
| Here the xsl:copy-of does a "deep" copy on the node returned by the XPath. This node is our "place-able" element, in this case, 'highlights' from the BusinessML, which has been transformed to 'div' in the StructureML. As will be seen in the source XML to the next "hop," the 'div' will be written to the appropriate <td> table cell in the Module, in the StructureLayoutML version. |
StructureLayoutML to SiteHTML
StructureLayoutML ct70_highlight_1abt_i.xml:
<table border="0" cellpadding="0" cellspacing="0"> <tr> <td><div> <div presentationStyle="ps70">
<div><p>Our first marketed product has been making a difference in the lives of patients with cardiovascular disease. <a href="/products/integrilin/index.asp">More</a>...</p></div> <div><p>The most advanced of our investigational drugs is being developed with the goal of making a difference in the lives of multiple myeloma patients. <a href="/rd/oncology/velcade/index.asp">More</a>...</p></div> </div> </div> </td>
"SH" XSLT = StructureLayoutML to SiteHTML: sh01_general.xslt: <xsl:template match="div"><xsl:choose> <xsl:when test="@presentationStyle='ps70'">
<table width="175" cellspacing="0" cellpadding="0" border="0"> <tr>
<td colspan="4"> <img src="/images/rt_side_hdr_hilite.gif" width="175" height="34" alt="" border="0"/> </td> </tr> <tr> <td width="1" CLASS="bgBeige"><img src="/images/spacer.gif" width="1" height="1" alt="" border="0"/></td> <td colspan="2"><img src="/images/spacer.gif" width="1" height="15" alt="" border="0"/></td> <td width="1" CLASS="bgBeige"><img src="/images/spacer.gif" width="1" height="1" alt="" border="0"/></td> </tr> ...
</tr> </table> </xsl:when> <xsl:otherwise>
<div> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </div> </xsl:otherwise> </xsl:choose> </xsl:template>
| Template matching on 'div' be it default or specialized presentation. |
| Finally, the "test" in XSL that determines if this 'div' has the "flag" that indicates it requires the special presentation treatment. |
| As can be seen from all this highly presentational HTML, the contents of this table are getting special, one-off presentation treatment. |
| Much HTML edited out (48 lines of code all told). |
| For 'div' elements that do not have presentationStyle=ps70, the default behavior is very straightforward (wrap in a 'div', copy-of (grabbing attributes), and apply-templates (keep going...). |
SiteHTML (and CSS)
SiteHTML ct70_highlight_1abt_i.html: <table border="0" cellpadding="0" cellspacing="0" width="175"> <tr><td colspan="4"><img border="0" alt="" height="34" width="175" src="/images/rt_side_hdr_hilite.gif"></td> </tr> <tr> <td CLASS="bgBeige" width="1">
<img border="0" alt="" height="1" width="1" src="/images/spacer.gif"></td> <td colspan="2"><img border="0" alt="" height="15" width="1" src="/images/spacer.gif"></td> <td CLASS="bgBeige" width="1"><img border="0" alt="" height="1" width="1" src="/images/spacer.gif"></td> </tr> <tr> <td CLASS="bgBeige"><img border="0" alt="" height="1" width="1" src="/images/spacer.gif"></td> <td align="center" valign="top">
<img border="0" alt="" height="5" width="1" src="/images/spacer.gif"><br> <img border="0" alt="" height="8" width="11" src="/images/blk_arrow_right.gif"> </td> <td> <div class="related">
Our first marketed product has been making a difference in the lives of patients with cardiovascular disease. <a href="/products/integrilin/index.asp">More</a>...</div> </td> <td CLASS="bgBeige"><img border="0" alt="" height="1" width="1" src="/images/spacer.gif"></td> </tr> ...
| As also noted in looking at the "SiteHTML XSLT" in the previous section, here we see the final result of highly presentational HTML: the contents of this table are getting special, one-off presentation treatment. |
| Here the background color presentation is kept separate one further step, by the standard means of Cascading Style Sheets (CSS). (See also snippet below.) |
| Spacer.gif files, special use of <br /> for line breaks, and special graphics (arrow) complete the very non-structural presentation of the content, for final "SiteHTML" look + feel. |
| And here the font choice for content presentation is also kept separate by means of CSS. (Again, see also snippet below.) |
ie_pc.css:
.bgBeige
{
background-color:#cc6600;
}
.related
{
font-family:arial,helvetica;
font-size:11px;
color:#0066cc;
margin:0px 12px 10px 0px;
}
| Standard use of CSS to separate out color decisions from content markup. |
| Here, an exception to the site's design re: font sizes: fixed font used in the tight real estate of the very presentational "Highlights" box. This prevents the user from increasing font size with her or his browser, which would cause the Highlights box to break. (Almost everywhere else on the site, the text is relatively sized; the user can adjust the font size if they wish). |
| CSS used to control whitespace, vertically and horizontally. This, as opposed to excessive use of spacer gifs, <br /> line breaks, etc., etc. Used wherever feasible. By the way, the four numbers are for the top, right, bottom and left respectively. |