Quantcast

The second argument of saxon:serialize must either be a string literal, or an xsl:output element

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

The second argument of saxon:serialize must either be a string literal, or an xsl:output element

andrew1.welch
Hi,

This xslt:

<xsl:stylesheet version="2.0"
   xmlns:saxon="http://saxon.sf.net/"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

   
<xsl:output name="aaa"/>
   
   
<xsl:variable name="chunk">
       
<chunk/>
   
</xsl:variable>

   
<xsl:template match="/">
       
<xsl:value-of select="saxon:serialize($chunk, 'aaa')"/>
   
</xsl:template>
</xsl:stylesheet>

fails in 9.7.0.7 with:

"The second argument of saxon:serialize must either be a string literal, or an xsl:output element"

but succeeds in 9.6.0.9

Equally a second arg of '' fails in 9.7.0.7, fine in previous versions.


Andrew1 WELCH
XML Developer | Finance & Regulatory IT | HSBC BANK PLC HBEU
8 Canada Square,Canary Wharf,London,E14 5HQ,United Kingdom
__________________________________________________________

Phone 0207 991 9571
Mobile 07717 684 177
Email andrew1.welch@...


__________________________________________________________
Protect our environment - please only print this if you have to!



************************************************************
HSBC Bank plc may be solicited in the course of its placement efforts for a new issue, by investment clients of the firm for whom the Bank as a firm already provides other services. It may equally decide to allocate to its own proprietary book or with an associate of HSBC Group. This represents a potential conflict of interest. HSBC Bank plc has internal arrangements designed to ensure that the firm would give unbiased and full advice to the corporate finance client about the valuation and pricing of the offering as well as internal systems, controls and procedures to identify and manage conflicts of interest.

HSBC Bank plc
Registered Office: 8 Canada Square, London E14 5HQ, United Kingdom
Registered in England - Number 14259
Authorised by the Prudential Regulation Authority and regulated by the Financial Conduct Authority and the Prudential Regulation Authority
************************************************************


-----------------------------------------
SAVE PAPER - THINK BEFORE YOU PRINT!

This E-mail is confidential. 

It may also be legally privileged. If you are not the addressee you may not copy,
forward, disclose or use any part of it. If you have received this message in error,
please delete it and all copies from your system and notify the sender immediately by
return E-mail.

Internet communications cannot be guaranteed to be timely secure, error or virus-free.
The sender does not accept liability for any errors or omissions.


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

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: The second argument of saxon:serialize must either be a string literal, or an xsl:output element

Michael Kay
I've reproduced this. saxon:serialize is implemented as an integrated extension function, and implements a method 

public void supplyStaticContext(StaticContext env, Location locationId, Expression[] arguments) throws XPathException {
which it expects to be called at compile time to supply static information about the stylesheet (so it can find the xsl:output declaration). But the method isn't being called, and that's because it fails to override the method declared in the superclass which is

public void supplyStaticContext(StaticContext context, int locationId, Expression[] arguments) throws XPathException {
An absolutely classic Java coding error, that goes undetected because there is no @Override annotation.

(The odd error message arises because this method sets up data if the argument is a string literal, and if that data is null then at run time the code is assuming that the argument can't have been a string literal).

I suspect the trigger for the problem was that I dithered about making a backwards-incompatible change to this public interface. The problem is that integer location id's are meaningless in 9.7, as a consequence of the modular compilation of packages. Generally everything has changed to using a Location object instead. So it seems I half made the change, and it broke as a result.


Michael Kay


On 22 Aug 2016, at 17:11, [hidden email] wrote:

Hi,

This xslt:

<xsl:stylesheet version="2.0"
   xmlns:saxon="http://saxon.sf.net/"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

   
<xsl:output name="aaa"/>
   
   
<xsl:variable name="chunk">
       
<chunk/>
   
</xsl:variable>

   
<xsl:template match="/">
       
<xsl:value-of select="saxon:serialize($chunk, 'aaa')"/>
   
</xsl:template>
</xsl:stylesheet>

fails in 9.7.0.7 with:

"The second argument of saxon:serialize must either be a string literal, or an xsl:output element"

but succeeds in 9.6.0.9

Equally a second arg of '' fails in 9.7.0.7, fine in previous versions.


Andrew1 WELCH
XML Developer | Finance & Regulatory IT | HSBC BANK PLC HBEU
8 Canada Square,Canary Wharf,London,E14 5HQ,United Kingdom
__________________________________________________________

Phone 0207 991 9571
Mobile 07717 684 177
Email [hidden email]


__________________________________________________________
Protect our environment - please only print this if you have to!



************************************************************
HSBC Bank plc may be solicited in the course of its placement efforts for a new issue, by investment clients of the firm for whom the Bank as a firm already provides other services. It may equally decide to allocate to its own proprietary book or with an associate of HSBC Group. This represents a potential conflict of interest. HSBC Bank plc has internal arrangements designed to ensure that the firm would give unbiased and full advice to the corporate finance client about the valuation and pricing of the offering as well as internal systems, controls and procedures to identify and manage conflicts of interest.

HSBC Bank plc
Registered Office: 8 Canada Square, London E14 5HQ, United Kingdom
Registered in England - Number 14259
Authorised by the Prudential Regulation Authority and regulated by the Financial Conduct Authority and the Prudential Regulation Authority
************************************************************


-----------------------------------------
SAVE PAPER - THINK BEFORE YOU PRINT!

This E-mail is confidential. 

It may also be legally privileged. If you are not the addressee you may not copy,
forward, disclose or use any part of it. If you have received this message in error,
please delete it and all copies from your system and notify the sender immediately by
return E-mail.

Internet communications cannot be guaranteed to be timely secure, error or virus-free.
The sender does not accept liability for any errors or omissions.

------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help


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

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Loading...