Skip to content

Instantly share code, notes, and snippets.

@tofi86
tofi86 / input.xml
Last active June 28, 2018 13:27
In XSLT, get a string that contains every character used in an XML input document exactly one time (no duplicates)
<?xml version="1.0" encoding="UTF-8"?>
<root>
<element>This is some sample text string with <bold>inline markup</bold> &amp; some special characters.</element>
<element>Also, named (&lt;), decimal (&#62;) and hexadecimal (&#x00A2;) entities should be respected.</element>
</root>
@xquery
xquery / gist:5594054
Last active January 22, 2020 00:12
illustration of mapreduce using xquery 3.0 word count example
xquery version "3.0";
declare function local:mapReduce(
$list as item()*,
$mapper as function(*),
$reducer as function(*)
)
{
let $intermediate := for $l at $pos in $list return $mapper("list" || $pos,$l)
return