Skip to content

Instantly share code, notes, and snippets.

@martinthomson
Created May 26, 2020 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinthomson/4e777ba5e5fdfa73cce1544b17d689ba to your computer and use it in GitHub Desktop.
Save martinthomson/4e777ba5e5fdfa73cce1544b17d689ba to your computer and use it in GitHub Desktop.
<dsig:Transform id="selective"
Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116"
xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
<dsig:XPath
xmlns:pidf="urn:ietf:params:xml:ns:pidf"
xmlns:gp="urn:ietf:params:xml:ns:pidf:geopriv10"
xmlns:dep="urn:ietf:params:xml:ns:pidf:geopriv10:dsig"
xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model">
<!-- The 'presence' element -->
(count(self::pidf:presence
| here()/ancestor::pidf:presence[1]) = 1)
<!-- The 'tuple' element and all selected descendants -->
or (((count(ancestor-or-self::pidf:tuple[1]
| here()/ancestor::pidf:tuple[1]) == 1)
or (count(ancestor-or-self::dm:device[1]
| here()/ancestor::dm:device[1]) == 1)
or (count(ancestor-or-self::dm:person[1]
| here()/ancestor::dm:person[1]) == 1))
and (self::pidf:tuple or self::dm:device
or self::dm:person or self::pidf:status
or ancestor-or-self::pidf:timestamp
or ancestor-or-self::dm:timestamp
or ancestor-or-self::dm:deviceID
or self::gp:geopriv or self::gp:usage-rules
or ancestor-or-self::gp:method
or ancestor-or-self::gp:location-info
or ancestor-or-self::dep:dependability))
<!-- All attributes (including namespace declarations) -->
<!-- Needed for elements without ancestor-or-self rules above -->
or ((count(self::node() | parent::*/attribute::*
| parent::*/namespace::*) + 1
== (count(self::node()) + count(parent::*/attribute::*)
+ count(parent::*/namespace::*)))
and parent::*[
(count(self::pidf:presence
| here()/ancestor::pidf:presence[1]) = 1)
or (((count(ancestor-or-self::pidf:tuple[1]
| here()/ancestor::pidf:tuple[1]) == 1)
or (count(ancestor-or-self::dm:device[1]
| here()/ancestor::dm:device[1]) == 1)
or (count(ancestor-or-self::dm:person[1]
| here()/ancestor::dm:person[1]) == 1))
and (self::pidf:tuple or self::dm:device
or self::dm:person or self::pidf:status
or self::gp:geopriv or self::gp:usage-rules))
])
</dsig:XPath>
</dsig:Transform>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment