Zhao
Zhao

Reputation: 2193

XSLT java functions in curly braces

I am learning XSLT and I see some codes like the following:

  <node id="{java:next($idgen)}:state" pred="should" mood="dcl">

where next is a java function. What are the curly braces used for?

Besides I am quite confused at how java functions are called in XSLT. In my sample code, XSLT just calls java functions like above without specifying the location of the java class file, even the class name is not specified.

Upvotes: 0

Views: 121

Answers (2)

michael.hor257k
michael.hor257k

Reputation: 117175

What are the curly braces used for?

The curly braces have nothing to do with Java. They indicate to the processor that the contents are to be evaluated as an expression - see: https://www.w3.org/TR/xslt/#attribute-value-templates

Besides I am quite confused at how java functions are called in XSLT.

That depends on your specific processor. Calling Java functions is not part of the XSLT standard, and only some processors support it as an extension.

Upvotes: 1

Martin Honnen
Martin Honnen

Reputation: 167781

You have shown a literal result element with an attribute value template where the XPath expression inside the attribute value template uses some XSLT processor specific mechanism to call a Java method of the variable $idgen.

Upvotes: 1

Related Questions