-
Notifications
You must be signed in to change notification settings - Fork 3
/
components.clj
27 lines (21 loc) · 870 Bytes
/
components.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
(ns sigel.xslt.components
"A set of reusable XSLT components."
(:require [sigel.xslt.elements :as xsl])
(:refer-clojure :exclude [identity]))
(def identity
"An XSLT identity template."
(xsl/template
{:match "@* | node()"}
(xsl/copy
(xsl/apply-templates {:select "@* | node()"}))))
(defn xslt3-identity
"An XSLT 3.0 stylesheet with an identity template and the XML Schema namespace
(http://www.w3.org/2001/XMLSchema) pre-bound to the `xs` namespace prefix."
[& [a & xs]]
(xsl/stylesheet (merge {:xmlns/xsl "http://www.w3.org/1999/XSL/Transform"
:version 3.0
:xmlns:xs "http://www.w3.org/2001/XMLSchema"
:exclude-result-prefixes "xs"} a)
identity
xs))
(def identity-transformation (xslt3-identity nil))