⚲
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 (1.4 KB)
Bug #1791
ยป GlobalParametersTest.java
O'Neil Delpratt
, 2013-05-31 12:40
import
java.io.*
;
import
java.util.*
;
import
javax.xml.transform.stream.*
;
import
net.sf.saxon.*
;
import
net.sf.saxon.s9api.*
;
import
org.junit.*
;
public
class
GlobalParametersTest
{
@Test
public
void
globalParametersTest
()
throws
UnsupportedEncodingException
,
SaxonApiException
{
Configuration
configuration
=
Configuration
.
newConfiguration
();
Processor
processor
=
new
Processor
(
configuration
);
XsltCompiler
xsltCompiler
=
processor
.
newXsltCompiler
();
String
source
=
"<?xml version='1.0'?>"
+
" <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"
+
" xmlns:xs='http://www.w3.org/2001/XMLSchema'"
+
" version='2.0'>"
+
" <xsl:param name='surname' as='xs:string' />"
+
" <xsl:param name='age' as='xs:integer' />"
+
" <xsl:template match='/'><xsl:element name='root' /></xsl:template>"
+
" </xsl:stylesheet>"
;
XsltExecutable
xsltExecutable
=
xsltCompiler
.
compile
(
new
StreamSource
(
new
ByteArrayInputStream
(
source
.
getBytes
(
"UTF-8"
))));
Map
<
QName
,
XsltExecutable
.
ParameterDetails
>
params
=
xsltExecutable
.
getGlobalParameters
();
System
.
out
.
println
();
int
i
=
0
;
for
(
QName
key:
params
.
keySet
())
{
System
.
out
.
println
(
"Parameter n."
+(++
i
)+
": "
+
key
);
}
System
.
out
.
println
();
}
}
(1-1/1)
Loading...