3

Basically what I would like is something like this that finds all nodes where the ID cannot be lookup'ed up ('broken links') :

<xsl:variable name="failedIDLookups" select="//inventory/box[@boxtypeID != //boxtypes/@ID]"/>

But this is not working as expected - I suppose the syntax is wrong, what should be the correct way of doing this ?

darune
  • 10,480
  • 2
  • 24
  • 62

1 Answers1

4

I suspect you want

<xsl:variable name="failedIDLookups" select="//inventory/box[not(@boxtypeID = //boxtypes/@ID)]"/>

which then could be optimized with a key declaration (as a child of xsl:stylesheet)

<xsl:key name="boxtypes-ref" match="boxtypes" use="@ID"/>

and

<xsl:variable name="failedIDLookups" select="//inventory/box[not(key('boxtypes-ref', @boxtypeID))]"/>
Martin Honnen
  • 160,499
  • 6
  • 90
  • 110