⚲
Project
Profile
Help
Tour this page
Frequent Planio Questions
Learning Resources
Sign in
Register
Switch Planio account
Open in Planio App
Share current page
Search
:
Projects
All Projects
Help
Tour this page
Frequent Planio Questions
Learning Resources
Sign in
Register
Switch Planio account
Open in Planio App
Share current page
Saxon
Overview
Roadmap
Issues
Calendar
Blog
Documents
Forums
Files
Repository
Download (2.05 KB)
Support #6518
ยป test.xsl
Uwe Lagler
, 2024-08-25 16:23
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform
version=
"3.0"
xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform"
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
xmlns:map=
"http://www.w3.org/2005/xpath-functions/map"
xmlns:my=
"http://www.example.org/xslt"
exclude-result-prefixes=
"#all"
>
<xsl:output
method=
"xml"
indent=
"yes"
encoding=
"UTF-8"
media-type=
"text/html"
omit-xml-declaration=
"no"
/>
<!-- Check if the provided param is of type "map" -->
<xsl:function
name=
"my:is-map"
visibility=
"public"
as=
"xs:boolean"
>
<xsl:param
name=
"item"
/>
<xsl:sequence
select=
"$item instance of map(xs:string, item())"
/>
</xsl:function>
<xsl:function
name=
"my:handle-map"
visibility=
"public"
>
<xsl:param
name=
"map"
as=
"map(xs:string, item())"
/>
<map>
<size><xsl:value-of
select=
"map:size($map)"
/></size>
</map>
</xsl:function>
<xsl:function
name=
"my:do-something"
visibility=
"public"
>
<xsl:param
name=
"item"
/>
<no-map>
Do something with other value than map.
</no-map>
</xsl:function>
<!-- This function is called as the initial function -->
<xsl:function
name=
"my:process"
visibility=
"public"
>
<xsl:sequence
select=
"
let $test1 := map{'a': 'b'},
$test2 := true(),
$value := $test2
return
if(my:is-map($value)) then(
my:handle-map($value)
) else(
my:do-something($value)
)
"
/>
<!-- THIS WORKS WITHOUT ERROR:
<xsl:sequence select="
let $test1 := map{'a': 'b'},
$test2 := true(),
$value := $test2
return
if($value instance of map(xs:string, item())) then(
my:handle-map($value)
) else(
my:do-something($value)
)
"/>
-->
</xsl:function>
</xsl:transform>
(1-1/1)
Loading...