Skip to content

Instantly share code, notes, and snippets.

@grantmacken
Created May 2, 2014 00:28
Show Gist options
  • Save grantmacken/7a3621ccaba917294641 to your computer and use it in GitHub Desktop.
Save grantmacken/7a3621ccaba917294641 to your computer and use it in GitHub Desktop.
using map in tests to check if node has tag-name
declare
%test:args('<a class="h-entry" href="http://microformats.org/2012/06/25/microformats-org-at-7">microformats.org at 7</a>')
%test:assertExists
%test:assertTrue
%test:assertXPath("count($result) = 1")
%test:assertXPath("local-name($result[1]) eq 'entry'")
%test:assertXPath(" 'name' = ( map(function($n) { local-name($n) }, $result[1]/*) ) ")
%test:assertXPath(" 'url' = ( map(function($n) { local-name($n) }, $result[1]/*) ) ")
function st:just-a-hyperlink($node as element()) as element() {
mf2:dispatch($node)
};
@grantmacken
Copy link
Author

'joe' = ( jack, jim , joe, )
true in xquery as 'joe' appears in sequence
our test
element tag-name should be nested in container element
use map to create sequence
'name' = ( map(function($n) { local-name($n) }, $result[1]/*) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment