Project

Profile

Help

map(*) xsl:message

Added by Vladimir Nesterovsky over 5 years ago

Hello!

According to xslt spec xsl:message constructs and prints content of the new document node. So, saxon gives an error on:

<xsl:message select="map { 'a' : 'b'}" />

Is there a standard (or through a built-in extension) way to print a map through xsl:message?


Replies (2)

RE: map(*) xsl:message - Added by Vladimir Nesterovsky over 5 years ago

I've found a way:

<xsl:message select="serialize(map { 'a' : 'b'}, map { 'method': 'json'})" />

Sorry for a noise.

RE: map(*) xsl:message - Added by Michael Kay over 5 years ago

In fact the spec has a rule:

Any dynamic error that occurs while evaluating the select expression or the contained sequence constructor, and any serialization error that occurs while processing the result, does not cause the transformation to fail; at worst, it means that no message is output, or that the only message that is output is one that relates to the error that occurred.

which Saxon was not implementing correctly: see bug https://saxonica.plan.io/issues/3892

But serializing the map and outputting the serialization gives you more control over the outcome.

    (1-2/2)

    Please register to reply