Fixed PDF rendering bug, and did minor edits to a review
Posted by mholmes on 16 Oct 2007 in Activity log
JT pointed out that some documents on the Proofing page were not rendering correctly as PDFs; the process failed with an XSL-FO error. I investigated this, and found that the problem was caused by empty elements for the page numbers:
<biblScope type="start-page"></biblScope> <biblScope type="end-page"></biblScope>
I started by confirming that this was the cause, by commenting them out (they're not needed anyway until the print publication finalizes the page numbers). Then I went back to fix the actual XSLT, and found the problem in the pdf_main_templates.xsl file, in the GetStartPage template. That's now doing some checking on the value of the tag before returning it, going from this:
<xsl:template name="GetStartPage">
<xsl:param name="DefValue"/>
<xsl:attribute name="initial-page-number">
<xsl:choose>
<xsl:when test="//teiHeader/fileDesc/sourceDesc/biblStruct/monogr/imprint/biblScope[@type='start-page']">
<xsl:value-of select="//teiHeader/fileDesc/sourceDesc/biblStruct/monogr/imprint/biblScope[@type='start-page']" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$DefValue" />
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:template>
to this:
<xsl:template name="GetStartPage">
<xsl:param name="DefValue"/>
<xsl:attribute name="initial-page-number">
<xsl:choose>
<xsl:when test="//teiHeader/fileDesc/sourceDesc/biblStruct/monogr/imprint/biblScope[@type='start-page'] and (string(number(//teiHeader/fileDesc/sourceDesc/biblStruct/monogr/imprint/biblScope[@type='start-page'])) != 'NaN')">
<xsl:value-of select="//teiHeader/fileDesc/sourceDesc/biblStruct/monogr/imprint/biblScope[@type='start-page']" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$DefValue" />
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:template>
I also noticed a couple of typos in the markup of a review, which I fixed, and reported to LN so he can fix them in his copy.