XPATH to strip all but 1st instance

The following snippet of an XSLT stylesheet shows how to remove everything from an XDS document except for the 1st node. This code is implemented as part of the Secondary Account Management Loopback Connector when:

  • A Resource is assigned, revoked, or deleted
  • The Object concerned has more than one Secondary account already assigned

As you can probably gather, the number of <modify> nodes which affect the Trigger attribute are counted. If the number of nodes IS NOT greater than one, the code is not processed. If the number of nodes IS greater than one, every <modify> node except for the first one is removed.