Paragraph number in link



I am generating PDFs of S1000D xml and need to display a link to another step, giving that steps number/letter designation. In the below image what currently shows as a link to 1.d. should read 1.c.


Current output


The source xml containing the ref is as follows:



<mainProcedure>
<proceduralStep id="S0001">
<para id="P0001">REMOVE COMPONENT XYZ.</para>
<proceduralStep id="S0002">
<para id="P0002">This is a second level procedural step.</para>
<proceduralStep id="S0003">
<para id="P0003">This is a third level procedural step.</para>
<proceduralStep id="S0004">
<para id="P0004">This is a fourth level procedural step.</para>
<proceduralStep id="S0006">
<para id="P0006">This is a fifth level procedural step.</para>
</proceduralStep>
</proceduralStep>
</proceduralStep>
</proceduralStep>
<proceduralStep id="S0005">
<para id="P0005">This is a second, second level procedural step.</para>
</proceduralStep>
<proceduralStep id="S0008">
<para id="P0008">The following sub-step has quantity data included.</para>
<proceduralStep id="S0009">
<para>Position bracket on frame and secure with bolts and washers. <emphasis
>TORQUE BOLT TO <quantity><quantityGroup quantityGroupType="minimum"
quantityUnitOfMeasure="ft.lbf"><quantityValue>10</quantityValue>
</quantityGroup><quantityGroup quantityGroupType="maximum"
quantityUnitOfMeasure="ft.lbf"><quantityValue>15</quantityValue>
</quantityGroup></quantity></emphasis>.</para>
</proceduralStep>
</proceduralStep>
<proceduralStep id="S0007">
<para id="P0007">This is a para with a reference to <internalRef
internalRefId="S0008" internalRefTargetType="step"> another step</internalRef
> in the procedure.</para>
</proceduralStep>
</proceduralStep>
</mainProcedure>


Here is the XSL I have that gives me the incorrect number/letter combo. It appears to be giving me the number for the step that contains the link (there is another template that handles the <quantity> data:



<xsl:template match="internalRef[@internalRefTargetType='step']">
<xsl:variable name="refId" select="./@internalRefId"/>
<xsl:if test="//mainProcedure//proceduralStep/@id = $refId">
<xsl:if test="//mainProcedure/proceduralStep/@id = $refId">
<fo:inline>
<fo:basic-link internal-destination="{$refId}" color="blue" text-decoration="underline">
Step <xsl:number level="multiple" count="mainProcedure/proceduralStep" format="1."/>
</fo:basic-link>
</fo:inline>
</xsl:if>
<xsl:if test="//mainProcedure/proceduralStep/proceduralStep/@id = $refId">
<fo:inline>
<fo:basic-link internal-destination="{$refId}" color="blue" text-decoration="underline">
Step <xsl:number level="multiple" count="//mainProcedure/proceduralStep" format="1."/><xsl:number level="single" count="//mainProcedure/proceduralStep | proceduralStep" format="a."/>
</fo:basic-link>
</fo:inline>
</xsl:if>
</xsl:if>
</xsl:template>


Any help getting me on the correct path is much appreciated.


No comments:

Post a Comment