Skip to content

Instantly share code, notes, and snippets.

View ndw's full-sized avatar

Norman Walsh ndw

View GitHub Profile
@ndw
ndw / test.xsl
Last active June 23, 2021 19:41
Return an array from a function in XSLT
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:array="http://www.w3.org/2005/xpath-functions/array"
xmlns:f="https://nwalsh.com/ns/functions"
xmlns:map="http://www.w3.org/2005/xpath-functions/map"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="array f map xs"
version="3.0">
<xsl:output method="xml" encoding="utf-8" indent="no"/>
@ndw
ndw / NioTest.java
Created September 5, 2021 08:47
Java program to demonstrate that NIO will delete files that are read-only
import java.io.FileOutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.PosixFilePermission;
import java.util.HashSet;
import java.util.Set;
public class NioTest {
public static void main(String[] argv) throws Exception {
Saxon 11.x produces:
<?xml version="1.0" encoding="UTF-8"?>
<root a="b"
c="d"
h="e"
f="g"
a1="b"
c1="d"
h1="e"