-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

/ [EMAIL PROTECTED] was heard to say:
| One such "error" I regularily come across during the conversion process is 
| <xref> tags pointing to invalid IDs. To help with me in the conversion 
| process, I'm looking to test my Docbook XML for the presence of an <xref>, 
| then look for the corresponding ID tag, the results being a nice little 
| list of just the problematic <xref> tags - using the list, I'd then be 
| able to manually check the source document, work out what the <xref> 
| should actually be doing and fix it in the Docbook XML.

Ok, then here's my suggestion.

1. Remove the <!DOCTYPE declaration so that the document is only WF
2. Try this stylesheet:

<xsl:stylesheet ...>

<xsl:template match="text()"/> <!-- who cares -->

<xsl:template match="*[@linkend]">
  <xsl:variable name="linkend" select="@linkend"/>
  <xsl:variable name="targets" select="//*[@id=$linkend]"/>
  <xsl:choose>
    <xsl:when test="count($targets) = 0">
      <xsl:message>invalid link: ...</xsl:message>
    </xsl:when>
    <xsl:when test="count($targets) &gt; 1">
      <xsl:message>link is not unique: ...</xsl:message>
    </xsl:when>
  </xsl:choose>
</xsl:template>
</xsl:stylesheet>

That should give you a summary of ID problems.

                                        Be seeing you,
                                          norm

- -- 
Norman Walsh <[EMAIL PROTECTED]>      | Men do not quit playing because
http://www.oasis-open.org/docbook/ | they grow old; they grow old
Chair, DocBook Technical Committee | because they quit playing.--Oliver
                                   | Wendell Holmes
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.7 <http://mailcrypt.sourceforge.net/>

iD8DBQE9pvrEOyltUcwYWjsRAvoPAKCN28ZdrpR83mMwjcs7cg44GgoPdgCfSwep
Lcc/MOEawH3bshlB4BkF4H8=
=y+67
-----END PGP SIGNATURE-----

Reply via email to