Re: [xsl] Need help finding invalid references to target IDs

Subject: Re: [xsl] Need help finding invalid references to target IDs
From: "Darcy Parker" <darcyparker@xxxxxxxxx>
Date: Thu, 26 Jun 2008 14:27:53 -0400
Hi Dave,

Here's one approach:

At the beginning of your XSL, make a key for @id attributes in the document.

Then for each @refid in the document, check if there is a matched key.
 If it doesn't report an error.

(Schematron is one way you could check this quickly... But if you want
a lighter weight XSLT, it should be simple to do.)

Darcy
On Thu, Jun 26, 2008 at 2:10 PM, Hintz, David L <david.hintz@xxxxxxxxxxx> wrote:
> Hi,
>
> This is probably a newbie question, although I've hacked a lot of XSLT
> for about a year.  This problem has me stumped, however.
>
> Our schema has numerous elements with "id" attributes (target IDs) and
> several with "refID" attributes (reference IDs).  Unfortunately, these
> are not defined as ID and IDREF respectively or I wouldn't be having
> this issue.  I need to compare all of the "refID" attributes in a
> document against all of the "id" attributes and generate a report
> showing the "refID" attributes that do not have a valid target.  I know
> this is probably only a few lines in XSLT, but I'm not sure where to
> even start to do this test.
>
> Can anyone get me started?
>
> Dave Hintz

Current Thread