⚲
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.55 KB)
Bug #5361
» SaxonMwe.java
MWE java class -
Clément Fournier
, 2022-02-27 17:17
import
net.sf.saxon.Configuration
;
import
net.sf.saxon.expr.Expression
;
import
net.sf.saxon.expr.LocalVariableReference
;
import
net.sf.saxon.om.StructuredQName
;
import
net.sf.saxon.sxpath.IndependentContext
;
import
net.sf.saxon.sxpath.XPathEvaluator
;
import
net.sf.saxon.sxpath.XPathExpression
;
import
net.sf.saxon.trans.XPathException
;
import
net.sf.saxon.value.BooleanValue
;
import
net.sf.saxon.value.SequenceType
;
/**
* @author Clément Fournier
*/
public
class
SaxonMwe
{
public
static
void
main
(
String
[]
args
)
throws
XPathException
{
Configuration
configuration
=
Configuration
.
newConfiguration
();
IndependentContext
staticCtx
=
new
IndependentContext
(
configuration
)
{
{
declareVariable
(
null
,
"falseVar"
);
}
@Override
public
Expression
bindVariable
(
StructuredQName
qName
)
throws
XPathException
{
LocalVariableReference
local
=
(
LocalVariableReference
)
super
.
bindVariable
(
qName
);
if
(
qName
.
getLocalPart
().
equals
(
"falseVar"
))
{
local
.
setStaticType
(
SequenceType
.
SINGLE_BOOLEAN
,
BooleanValue
.
FALSE
,
0
);
}
return
local
;
}
};
final
XPathEvaluator
xpathEvaluator
=
new
XPathEvaluator
(
configuration
);
xpathEvaluator
.
setStaticContext
(
staticCtx
);
XPathExpression
xpathExpression
=
xpathEvaluator
.
createExpression
(
"//A[$falseVar=true()][child::*[2]]"
);
}
}
(1-1/1)
Loading...