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 ?
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))]"/>