I am attaching my latest Electronica.xquery that I currently use to generate m3u8 playlists containing unique tracks from my library. This one has some query issues resolved. Also this shows examples of different ways to filter in XQuery:
xquery version "3.0";
declare option saxon:output "encoding=UTF-8";
declare option saxon:output "method=xml";
declare option saxon:output "indent=yes";
declare option saxon:output "omit-xml-declaration=no";
<output>{
for $x in doc("..\Digital_Audio.xml")/body/media_file
where (xs:short($x/tag/rating) > 3 or xs:short($x/tag/rating) = 0) and
$x/file/duration_in_seconds > 90 and
$x/file/duration_in_seconds < 1200 and
matches($x/tag/genre, 'Industrial|Electronic') and
matches($x/file/name/text(), '.*\.flac|.*\.ogg|.*\.mp3|.*\.ape') and
(: below are artists to generally exclude :)
$x/tag/artist != 'Kraftwerk' and
(: below are albums to generally exclude :)
$x/tag/album != 'Quake Soundtrack' and
$x/tag/album != 'Music For Yoga' and
$x/tag/album != '20XX Volume I: A Tribute To The Music of Mega Man X (Full-Length Edition)' and
$x/tag/album != '20XX Volume II: A Tribute To The Music of Mega Man X' and
$x/tag/album != 'Stalker: Scenes From A Slasher Film' and
$x/tag/album != 'Future Past: A Tribute Collection' and
$x/tag/album != 'Stalker: The Final Cut' and
$x/tag/album != 'Syndicate: The Heist' and
$x/tag/album != '5 Minute Meditations' and
$x/tag/album != 'Remedy' and
$x/tag/album != 'Rooty' and
$x/tag/album != 'Kish Kash' and
$x/tag/album != 'No Time To Lose - Ingen tid å miste (original soundtrack)' and
$x/tag/album != 'Asimov (music inspired by the writings of)' and
$x/tag/album != "World's End" and
$x/tag/album != 'Featherlight (featuring Heather Feather ASMR)' and
not($x/tag/album = 'Trappist-1' and $x/tag/album_artist = 'Lee Rosevere') and
not($x/tag/album = 'Borderlands' and $x/tag/album_artist = 'Evan Bartholomew') and
not($x/tag/album = 'Live' and $x/tag/album_artist = 'Street Cleaner') and
not($x/tag/album = 'The Grid' and $x/tag/album_artist = 'Occams Laser') and
not($x/tag/album = 'Return To The Grid' and $x/tag/album_artist = 'Occams Laser') and
(: below are 16-bit releases to exclude due to having 24-bit releases to play instead :)
$x/tag/album != 'Oxygene 7-13' and
$x/tag/album != 'Oxygene' and
$x/tag/album != 'Dreamtime Physics' and
$x/tag/album != 'Kykeon' and
$x/tag/album != 'Hypatia' and
$x/tag/album != 'The Slip' and
$x/tag/album != 'Hesitation Marks' and
$x/tag/album != 'Hesitation Marks (48kHz)' and
(: below are albums to exclude due to having re-releases to play instead :)
not($x/tag/album = 'Elementary Particles + Prima Materia' and $x/tag/album_artist = 'Bluetech') and
not($x/tag/album = 'Sines And Singularities' and $x/tag/album_artist = 'Bluetech') and
not($x/tag/album = 'The 4 Horsemen of The Electrocalypse: The Red Horse' and $x/tag/album_artist = 'Bluetech') and
not($x/tag/album = 'The 4 Horsemen of The Electrocalypse: The White Horse' and $x/tag/album_artist = 'Bluetech') and
not($x/tag/album = 'The 4 Horsemen of The Electrocalypse: The Black Horse' and $x/tag/album_artist = 'Bluetech') and
not($x/tag/album = 'The 4 Horsemen of The Electrocalypse: The Pale Horse' and $x/tag/album_artist = 'Bluetech') and
not($x/tag/album = 'The 4 Horsemen of The Electrocalypse: The Pale Horse' and $x/tag/album_artist = 'Bluetech') and
not($x/tag/album = 'Evil Awaits' and $x/tag/album_artist = 'Stilz') and
not($x/tag/album = 'Cannibal Girls' and $x/tag/album_artist = 'Destryur') and
not($x/tag/album = 'Incipience 4: Live at LuvAFair October 6th, 1982' and $x/tag/album_artist = 'Images In Vogue') and
(: below are tracks to generally exclude :)
not($x/tag/album = 'Sleepwalking (Album) [Deluxe Edition]' and $x/tag/album_artist = 'Nina' and xs:short($x/tag/track) >= 12) and
not($x/tag/album = 'Singularities' and $x/tag/album_artist = 'Bluetech') and
(: temporarily excluding these below, because they currently get played too much :)
not($x/tag/album = 'The Complete Discography Vol. 1' and $x/tag/album_artist = 'The Enigma TNG') and
not($x/tag/album = 'Anthology' and $x/tag/album_artist = 'Ponies At Dawn') and
not($x/tag/album = 'Rebirth' and $x/tag/album_artist = 'Ponies At Dawn') and
not($x/tag/album_artist = 'Stilz' and xs:short($x/tag/rating) < 5 and xs:integer($x/tag/year) < 2018) and
not($x/tag/artist = 'Occams Laser' and xs:short($x/tag/rating) < 5 and xs:integer($x/tag/year) < 2018) and
(: below are singles from compilations to exclude due to also existing on released albums :)
not($x/tag/album = 'A Synthwave Compilation' and
($x/tag/title = 'Nitronaut' or
$x/tag/title = 'Soulreaper' or
$x/tag/title = 'Wormhole' or
$x/tag/title = 'Flagellation' or
$x/tag/title = 'Murdercycle' or
$x/tag/title = 'DiscoDeath' or
$x/tag/title = 'Deadly Curves')
) and
not($x/tag/album = 'French Synthwave Compilation Vol.1' and
($x/tag/title = 'Infosphere' or
$x/tag/title = 'Nominal Performance' or
$x/tag/title = 'Wormhole' or
$x/tag/title = 'Flagellation' or
$x/tag/title = 'Murdercycle' or
$x/tag/title = 'Deadly Curves')
) and
not($x/tag/album = 'French Synthwave Compilation Vol.2' and
($x/tag/title = 'Color Depth' or
$x/tag/title = 'Deathcruiser')
) and
(: below are singles to exclude due to also existing on released albums :)
not($x/tag/album = '' and $x/tag/title = 'Berserker (Single)' and $x/tag/album_artist = 'Contre-Attaque') and
not($x/tag/album = '' and $x/tag/title = 'Save The World [Single]' and $x/tag/album_artist = 'Contre-Attaque') and
not($x/tag/album = '' and $x/tag/title = 'Say maS' and $x/tag/album_artist = 'Processor') and
not($x/tag/album = '' and $x/tag/title = 'Supermodel' and $x/tag/album_artist = 'Processor') and
not($x/tag/album = '' and $x/tag/title = 'Void Calm' and $x/tag/album_artist = 'Processor') and
not($x/tag/album = '' and $x/tag/title = 'Dogs of War' and $x/tag/album_artist = 'Processor') and
not($x/tag/album = '' and $x/tag/title = 'S T y X' and $x/tag/album_artist = 'Processor') and
not($x/tag/album = '' and $x/tag/title = 'Reborn' and $x/tag/album_artist = 'Processor') and
not($x/tag/album = '' and $x/tag/title = 'Overseer' and $x/tag/album_artist = 'Daniel Deluxe') and
not($x/tag/album = '' and $x/tag/title = 'Freedom Bill' and $x/tag/album_artist = 'Infected Mushroom, Freedom Fighters and Mr. Bill') and
not($x/tag/album = '' and $x/tag/title = 'Altered Code' and $x/tag/album_artist = 'D-Noise') and
not($x/tag/album = '' and $x/tag/title = 'Atomic' and $x/tag/album_artist = 'she') and
not($x/tag/album = 'Collected Works' and $x/tag/album_artist = 'Roex') and
not($x/tag/album = 'Various Objekts 4: A Bass Agenda Recordings Sampler' and $x/tag/title = 'Surrender or Be Destroyed!!!' and $x/tag/album_artist = 'Bass Agenda Recordings') and
not($x/tag/album = 'Various Objekts 4: A Bass Agenda Recordings Sampler' and $x/tag/title = 'Anybody In Town' and $x/tag/album_artist = 'Bass Agenda Recordings') and
not($x/tag/album = 'Various Objekts 5' and $x/tag/title = 'Engineering' and $x/tag/album_artist = 'Bass Agenda Recordings') and
not($x/tag/album = 'Tokyo Rose & Friends' and $x/tag/title = 'Moshi Moshi' and $x/tag/album_artist = 'Tokyo Rose') and
not($x/tag/album = 'Tokyo Rose & Friends' and $x/tag/title = 'BLVCK' and $x/tag/album_artist = 'Tokyo Rose') and
not($x/tag/album = 'Tokyo Rose & Friends' and $x/tag/title = 'Genesis' and $x/tag/album_artist = 'Tokyo Rose') and
not($x/tag/album = 'Tokyo Rose & Friends' and $x/tag/title = 'Nobodies' and $x/tag/album_artist = 'Tokyo Rose') and
not($x/tag/album = 'Best of 2016 - 2018' and $x/tag/title = 'I See Murder (feat Lebrock)' and $x/tag/album_artist = 'PowerNerd') and
not($x/tag/album = '' and $x/tag/title = 'Dehumanize' and $x/tag/album_artist = 'Deathwire') and
not($x/tag/album = '' and $x/tag/title = 'Fxck My Brain [Single]' and $x/tag/album_artist = 'Deathwire') and
not($x/tag/album = 'Drift' and $x/tag/album_artist = 'DeadLife') and
not($x/tag/album = 'Vanitas' and $x/tag/title = 'Apotheosica' and $x/tag/album_artist = 'King Stephen') and
not($x/tag/album = 'Hellraiser' and $x/tag/title = 'Impulse' and $x/tag/album_artist = 'D-Noise') and
not($x/tag/album = 'Non Paradisi' and $x/tag/title = '4th' and $x/tag/album_artist = 'GosT') and
not($x/tag/album = 'Just Drive (Part 1)' and $x/tag/title = 'A Sea of Stars (feat. Dora Pereli)' and $x/tag/album_artist = 'WolfClub') and
not($x/tag/album = 'Runaways' and $x/tag/title = 'All We Live For' and $x/tag/album_artist = 'WolfClub') and
not($x/tag/album = 'Runaways' and $x/tag/title = 'Rebels' and $x/tag/album_artist = 'WolfClub') and
not($x/tag/album = "The 80's Dream Compilation Tape - Vol. 2" and $x/tag/title = 'Dataline' and $x/tag/album_artist = 'NewRetroWave') and
not($x/tag/album = 'Monstercat - Best of 2020' and $x/tag/title = 'Ani Mevushal' and $x/tag/album_artist = 'Monstercat') and
not($x/tag/album = 'Monstercat - Best of 2020' and $x/tag/title = 'Gold' and $x/tag/album_artist = 'Monstercat') and
not($x/tag/album = 'Accelerate LP' and $x/tag/title = 'XLD' and $x/tag/album_artist = 'Tyr Kohout') and
not($x/tag/album = 'Accelerate LP' and $x/tag/title = 'Avarice' and $x/tag/album_artist = 'Tyr Kohout') and
not($x/tag/album = 'Prismtek (Single)' and $x/tag/title = 'Prismtek' and $x/tag/album_artist = 'DreamReaper') and
not($x/tag/album = 'Criquets' and $x/tag/title = 'Shadows' and $x/tag/album_artist = 'Index Code') and
not($x/tag/album = 'My Life' and $x/tag/title = 'My Life (Original Mix)' and $x/tag/album_artist = 'FM Attack') and
not($x/tag/album = 'Artoffact Records 2020 Sampler' and $x/tag/title = 'Night Flower (with Edward KaSpel)' and $x/tag/album_artist = 'Artoffact Records') and
not($x/tag/album = 'Artoffact Records 2020 Sampler' and $x/tag/title = 'Battle Cry' and $x/tag/album_artist = 'Artoffact Records') and
not($x/tag/album = 'Odyssey' and $x/tag/title = 'Queen of Hearts' and $x/tag/album_artist = 'Michael Oakley') and
not($x/tag/album = 'Jaded Shadow' and $x/tag/album_artist = 'Signal Void' and $x/tag/track = ('02', '03', '05', '09', '10', '11', '12'))
order by $x/@src
return <result>{$x/@src} {$x/tag/artist} {$x/tag/album} {$x/tag/title}</result>
}</output>