xsl-list
[Top] [All Lists]

Re: [xsl] How to make a xsl:function that returns the function()

2013-01-21 00:24:06
Dear Michael Kay,

Thank you for your reply.
The problem has been fixed according to your suggestion.

Regards,

------------------------------

Date: Sat, 19 Jan 2013 15:51:25 +0000
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: Michael Kay <mike(_at_)saxonica(_dot_)com>
Subject: Re: [xsl] How to make a xsl:function that returns the function()
Message-ID: <50FAC0FD(_dot_)8030006(_at_)saxonica(_dot_)com>

It's actually a NullPointerException within Saxon; oXygen is hiding the
gory detail of the internal error.

As a workaround, use "name(.)" rather than name(). Saxon has trouble
with context-sensitive functions within higher order functions. I'm not
sure of the exact cause and will investigate further. You can track it here:

https://saxonica.plan.io/issues/1689

Michael Kay
Saxonica

On 19/01/2013 15:16, Toshihiko Makita wrote:

Hi List,

I'm very interested in XSLT 3.0 and have a question about the function
that returns the function as its return value.
Is it possible to make a such xsl:function?
I tested using the following code in oXygen 14.1 with Saxon 9.4.0.4.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:ahf="http://www.yahoo.co.jp/tmakita";>

<xsl:template match="root">
<xsl:variable name="slectFunc" as="function(*)"
select="ahf:funcGetChildElementByName('d')"/>
<xsl:copy>
<xsl:sequence select="$slectFunc(.)"/>
</xsl:copy>
</xsl:template>

<xsl:function name="ahf:funcGetChildElementByName" as="function(*)">
<xsl:param name="prmElemName" as="xs:string"/>
<xsl:sequence select="function($a as element()) as element()*
{$a/child::*[starts-with(name(),$prmElemName)]}"/>
</xsl:function>

</xsl:stylesheet>

However Saxon returns following error.

System ID: D:\My Documents\Proj\XSLT-TEST\20130113-func\test.xsl
Main validation file: D:\My Documents\Proj\XSLT-TEST\20130113-func\test.xsl
Engine name: Saxon-EE 9.4.0.4
Severity: error
Description: 0

Is there any workarounds?

Regards,

Toshihiko Makita

-- 
/*--------------------------------------------------
 Toshihiko Makita
 Development Group. Antenna House, Inc. Ina Branch
 E-Mail tmakita(_at_)antenna(_dot_)co(_dot_)jp
 8077-1 Horikita Minamiminowa Vil. Kamiina Co.
 Nagano Pref. 399-4511 Japan 
 Tel +81-265-76-9300 Fax +81-265-78-1668
 Web site: 
 http://www.antenna.co.jp/
 http://www.antennahouse.com/
 --------------------------------------------------*/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--