|
Subject: [xsl] Using saxon-js to run a javasscript function from XSLT at the command line From: "dvint@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 20 May 2025 05:09:20 -0000 |
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mf="http://example.org/my-functions" xmlns:js="http://saxonica.com/ns/globalJS" xmlns:saxon="http://saxon.sf.net/" xmlns="http://www.w3.org/2005/xpath-functions" exclude-result-prefixes="xs js ping mf" version="3.0">
<xsl:function name="mf:greet" as="xs:string">
<xsl:param name="name" as="xs:string"/>
<xsl:sequence select="saxon:call('greet', $name)"/>
</xsl:function> <xsl:template match="/">
<result>
<xsl:value-of select="mf:greet('World')"/>
</result>
</xsl:template>
<xsl:stylesheet> // my-functions.js
function greet(name) {
return "Hello, " + name + "!";
}| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] xml-to-json: element foun, Graydon graydon@xxxx | Thread | Re: [xsl] Using saxon-js to run a j, Michael Mueller-Hill |
| Re: [xsl] xml-to-json: element foun, Graydon graydon@xxxx | Date | Re: [xsl] Using saxon-js to run a j, Michael Mueller-Hill |
| Month |