[xsl] Re: Spam:[xsl] Detecting missing link destinations

Subject: [xsl] Re: Spam:[xsl] Detecting missing link destinations
From: JBryant@xxxxxxxxx
Date: Fri, 13 May 2005 10:05:18 -0500
Hi, Peter,

What FO processor are you using? FOP gives me errors when I manage to 
create internal-destination="" from my XSLT.

Short of changing processors, you could try checking the value of the xref 
before you use it, thus:

<xsl:variable name="xref" select="whatever-you-use-for-an-xref-value"/>

<xsl:choose>
  <xsl:when test="string-length($xref) = 0">
    <xsl:message>Ruh Roh! Empty internal destination!</xsl:message>
  </xsl:when>
  <xsl:otherwise>
    <fo:basic-link internal-destination="$xref"/>
  </xsl:otherwise>
</xsl:choose>

Of course, you can add identifying values to the message. For example, if 
there's always an element named heading with a title attribute somewhere 
above the point where you have inserted a cross-reference, you could add 
<xsl:value-of select="ancestor::heading/@title"/> and get the name of the 
nearest heading in the message. (You may need to add a predicate if you 
have heading elements within heading elements. In that case [1] gets the 
nearest one.) If you do have that kind of structure, the message 
instruction could look like this:

    <xsl:message>Ruh Roh! Empty internal destination below <xsl:value-of 
select="ancestor::heading/@title"/>!</xsl:message>

HTH

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)

Current Thread