..
/
download
<?xml version='1.0'?>
<!-- 8/18/11 - KR - Removed xsl text automatically concatenating mm to width and height -->
<!-- 8/19/11 - KR - Corrected problem with figure ids that caused figure references to not work -->
<!-- 8/19/11 - KR - added dmc to ids to make them unique in pubs -->
<!-- 8/19/11 - KR - added a check for a reproduction value that is numeric only and assumes uom is mm if it finds one -->
<!-- 8/22/11 - KR - added coding for reproduction scale based on clarifications in Issue 4.1 -->
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="figure">
<xsl:if test="@changeMark!=0">
<fo:change-bar-begin change-bar-class="figure" change-bar-style="solid" change-bar-color="black"
change-bar-offset="8pt" change-bar-placement="left"/>
</xsl:if>
<xsl:choose>
<xsl:when test="@changeType">
<xsl:if test="@changeType!='delete'">
<xsl:apply-templates select="graphic"/>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="graphic"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="@changeMark!=0">
<fo:change-bar-end change-bar-class="figure"/>
</xsl:if>
</xsl:template>
<!--MIL-STD-3031A, para 5.14.1.3 Figure title.
The figure title format shall:
a. Include "Figure" in title case, followed by the figure number, a period, two spaces, and
the title. (For example, "Figure 3. Fuel Indicator.")
b. Capitalize the first letter of the first and each major word of the title.
c. End with a period following the last word.
d. Identify illustrations applicable to one Service in a joint service TM. (For example,
"Figure 3. Fuel Indicator (Army Only).")
e. Identify illustrations applicable to more than one Service in a joint service TM. (For
example, "Figure 3. Indicator (Army and Air Force Only).")
f. When too long to fit on one line, align the second line with the first letter of the title.-->
<!--S1000D-i4.0.1_r1, Chap 3.9.5.2.1.5, para 2,
In procedural, process, crew and fault data modules, titles must be included for <figure>
and <table> for formal tables. -->
<!--S1000D-i4.0.1_r1, Chap 6.2.2, para 2.13.1
Changes to figures, including their title lines, must be marked at the figure title line.-->
<xsl:template match="figure/title">
<xsl:apply-templates/>
</xsl:template>
<!--from MIL-STD-3031A, para 5.138.7.2.1 Color
Unless specified otherwise by the acquiring activity, black and shades of black (gray scale) shall
be used for figures in page oriented publications.-->
<xsl:template match="figure/graphic" priority="10">
<fo:block text-align="center" start-indent="0pt" color="black" keep-with-next="always">
<xsl:if test="@changeMark!=0">
<fo:change-bar-begin change-bar-style="solid" change-bar-color="black"
change-bar-offset="8pt" change-bar-placement="left"/>
</xsl:if>
<xsl:choose>
<xsl:when test="@changeType">
<xsl:if test="@changeType!='delete'">
<xsl:call-template name="do-graphic">
<xsl:with-param name="include-graphic" select="true()"/>
</xsl:call-template>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="do-graphic">
<xsl:with-param name="include-graphic" select="true()"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="@changeMark!=0">
<fo:change-bar-end/>
</xsl:if>
</fo:block>
<xsl:if test="position()=last()">
<xsl:apply-templates select="../legend"/>
</xsl:if>
<!--MIL-STD-3031A, para 5.63.1.2, ICN shall be placed outside the graphic except in cases where legacy
graphics are used which already contain the ICN within the graphic and
the project would encounter expense to remove it. The information control
numbers are normally derived from the XML attribute infoEntityIdent
and put in place by the page layout system. (JS) -->
<xsl:if test="@infoEntityIdent">
<fo:block text-align="right" keep-with-previous="always">
<xsl:value-of select="@infoEntityIdent"/>
</fo:block>
</xsl:if>
<!--MIL-STD-3031A, para 5.32.1.4,
The use of the attribute id is required on the following items:
a. <figure>-->
<fo:block font-weight="bold" text-align="center" space-before="12pt" space-after="8pt" start-indent="0pt" keep-with-previous="always">
<!-- 8/19/11 - KR - corrected test to look at id on figure instead of graphic -->
<xsl:if test="../@id">
<xsl:attribute name="id">
<!-- 8/19/11 - KR - added dmc to ids to make them unique in pubs -->
<xsl:apply-templates select="//dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode"/>
<!-- 8/19/11 - KR - corrected value to get id from figure instead of graphic -->
<xsl:value-of select="../@id"/>
</xsl:attribute>
</xsl:if>
<!--MIL-STD-3031A, para 5.14.1.3 Figure title.
The figure title format shall:
a. Include "Figure" in title case, followed by the figure number, a period, two spaces, and
the title. (For example, "Figure 3. Fuel Indicator.")
b. Capitalize the first letter of the first and each major word of the title.
c. End with a period following the last word.
d. Identify illustrations applicable to one Service in a joint service TM. (For example,
"Figure 3. Fuel Indicator (Army Only).")
e. Identify illustrations applicable to more than one Service in a joint service TM. (For
example, "Figure 3. Indicator (Army and Air Force Only).")
f. When too long to fit on one line, align the second line with the first letter of the title.-->
<!--MIL-STD-3031A, para 5.14.1.5 Figure numbers.
Figure numbers shall be included for all illustrations except inline graphics (example equation).
Figures shall be numbered using Arabic numbers sequentially within each data module starting
with the Arabic numeral 1. The figure number shall precede the title.-->
<!-- MIL-STD-3031, para 5.37.1.30 -
The attribute catalogSeqNumberValue on the first occurrence of <catalogSeqNumber> in each IPD data
module is required. It shall be used to generate IPD figure numbers.
-->
<xsl:text>Figure </xsl:text>
<xsl:choose>
<xsl:when test="ancestor-or-self::illustratedPartsCatalog">
<xsl:variable name="extractFigNo">
<xsl:value-of select="string-length(//catalogSeqNumber[1]/@catalogSeqNumberValue)-6"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="substring(//catalogSeqNumber[1]/@catalogSeqNumberValue, $extractFigNo, 2)>9">
<xsl:value-of select="substring(//catalogSeqNumber[1]/@catalogSeqNumberValue, $extractFigNo, 2)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring(//catalogSeqNumber[1]/@catalogSeqNumberValue, $extractFigNo+1, 1)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:number count="figure" level="any" format="1" from="content"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>. </xsl:text>
<xsl:apply-templates select="../title"/>
<!--from MIL-STD-3031A, para 5.138.7.1, Table LVI Army business rules - figures.
When an illustration requires several sheets,
identification similar to (Sheet X of Y) shall be added after the title.
All sheets of a multi-sheet illustration shall be considered one figure.
Multisheet figures shall be consecutively numbered and the total number of sheets following the title
Remaining sheet shall be numbered in consecutive order.-->
<xsl:variable name="numSheets" select="count(../graphic)"/>
<xsl:choose>
<xsl:when test="$numSheets>1">
<xsl:text> (Sheet </xsl:text>
<xsl:number count="graphic" level="any" format="1" from="figure"/>
<xsl:text> of </xsl:text>
<xsl:value-of select="$numSheets"/>
<xsl:text>)</xsl:text>
<xsl:if test="@applicRefId">
<xsl:text> (Applicable to: </xsl:text>
<xsl:apply-templates select="@applicRefId"/>
<xsl:text>)</xsl:text>
</xsl:if>
</xsl:when>
</xsl:choose>
<xsl:text>.</xsl:text>
</fo:block>
</xsl:template>
<xsl:template match="symbol" priority="5">
<!-- KR - 3/30/11, Moved block to wcn for symbols in wcn's so they all appear on one line -->
<xsl:call-template name="do-graphic">
<xsl:with-param name="include-graphic" select="true()"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="do-graphic">
<xsl:param name="include-graphic" select="true()"/>
<xsl:variable name="content-width">
<xsl:choose>
<xsl:when test="@reproductionWidth != ''">
<xsl:value-of select="@reproductionWidth"/>
<xsl:call-template name="checkForUom">
<xsl:with-param name="measure" select="@reproductionWidth"/>
</xsl:call-template>
<!-- 8/18/11 - KR - this should be corrected in markup, not style sheets -->
<!--
<xsl:text>mm</xsl:text>
-->
</xsl:when>
<!-- 8/22/11 - KR - added coding for reproduction scale based on clarifications in Issue 4.1 -->
<xsl:when test="@reproductionScale != ''">
<xsl:value-of select="@reproductionScale"/>
<xsl:text>%</xsl:text>
</xsl:when>
<xsl:otherwise>auto</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="content-height">
<xsl:choose>
<xsl:when test="@reproductionHeight != ''">
<xsl:value-of select="@reproductionHeight"/>
<xsl:call-template name="checkForUom">
<xsl:with-param name="measure" select="@reproductionWidth"/>
</xsl:call-template>
<!-- 8/18/11 - KR - this should be corrected in markup, not style sheets -->
<!--
<xsl:text>mm</xsl:text>
-->
</xsl:when>
<!-- 8/22/11 - KR - added coding for reproduction scale based on clarifications in Issue 4.1 -->
<xsl:when test="@reproductionScale != ''">
<xsl:value-of select="@reproductionScale"/>
<xsl:text>%</xsl:text>
</xsl:when>
<xsl:otherwise>auto</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$include-graphic">
<fo:external-graphic src="{unparsed-entity-uri(@infoEntityIdent)}" scaling="uniform"
content-height="{$content-height}" content-width="{$content-width}"/>
</xsl:when>
<xsl:otherwise>
<fo:inline-container display-align="center" text-align="center"
block-progression-dimension="{$content-height}"
inline-progression-dimension="{$content-width}" background-color="silver"
color="red">
<fo:block>Graphic Not Included</fo:block>
</fo:inline-container>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="checkForUom">
<xsl:param name="measure" select=""/>
<xsl:variable name="lastchar" select="substring($measure,string-length($measure),1)"/>
<xsl:if test="$lastchar >= '0' and $lastchar <='9'">
<xsl:text>mm</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="graphic">
<fo:inline-container>
<fo:block space-before="12pt" space-before.conditionality="retain">
<xsl:call-template name="do-graphic"/>
</fo:block>
</fo:inline-container>
</xsl:template>
<!--MIL-STD-3031A, para 5.128.3.1.1.5 Foldout pages:
If foldout pages are approved by the acquiring activity, they shall be the last printed material in
the manual or volume.-->
<!--MIL-STD-3031A, para 5.137.4.1 Army business rules - folding and binding:
Foldout pages shall be the last printed material in the manual or volume.-->
<xsl:template match="foldout">
<xsl:choose>
<xsl:when test="ancestor::pm">
<xsl:apply-templates select="figure"/>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
gopher://khzae.net/0/s1kd/links/projects/3031/sample/PhunGun/CSDB/FO-3031-A00-S1000DGUN-FIGURE_001-00_EN-US.xsl