This repository was archived by the owner on Oct 5, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
app/templates/rest-api/transforms Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 33REST transform for returning XML with indentation for the purpose of showing it to the end user.
44-->
55<xsl : stylesheet version =" 2.0" xmlns : xsl =" http://www.w3.org/1999/XSL/Transform"
6+ xmlns : map =" http://marklogic.com/xdmp/map"
7+ xmlns : util =" http://marklogic.com/utilities"
8+ xmlns : xdmp =" http://marklogic.com/xdmp"
9+
10+ extension-element-prefixes =" xdmp"
611 exclude-result-prefixes =" #all" >
712
13+ <xdmp : import-module namespace =" http://marklogic.com/utilities" href =" /lib/utilities.xqy" />
14+
15+ <xsl : param name =" context" as =" map:map" />
16+ <xsl : param name =" params" as =" map:map" />
17+
818 <xsl : output indent =" yes" omit-xml-declaration =" yes" />
919 <xsl : strip-space elements =" *" />
1020
@@ -15,7 +25,17 @@ REST transform for returning XML with indentation for the purpose of showing it
1525 </xsl : template >
1626
1727 <xsl : template match =" /" >
18- <xsl : apply-templates select =" ." />
28+ <xsl : variable name =" uri" select =" map:get($context, 'uri')" />
29+ <xsl : variable name =" content-type" select =" util:get-content-type($uri, /)" />
30+ <xsl : sequence select =" map:put($context, 'output-type', $content-type)" />
31+ <xsl : choose >
32+ <xsl : when test =" element()" >
33+ <xsl : apply-templates />
34+ </xsl : when >
35+ <xsl : otherwise >
36+ <xsl : sequence select =" ." />
37+ </xsl : otherwise >
38+ </xsl : choose >
1939 </xsl : template >
2040
2141</xsl : stylesheet >
You can’t perform that action at this time.
0 commit comments