xsl-list
[Top] [All Lists]

Re: Spam:[xsl] Detecting missing link destinations

2005-05-13 08:05:18
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)

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>