Re: [xsl] Odd Result-Document Behavior

Subject: Re: [xsl] Odd Result-Document Behavior
From: "Eliot Kimber ekimber@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 23 Dec 2015 18:13:28 -0000
I was afraid of that. OK, I!&ll report it.

Cheers,

Eliot
----
Eliot Kimber, Owner
Contrext, LLC
http://contrext.com




On 12/23/15, 12:03 PM, "Martin Honnen martin.honnen@xxxxxx"
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

>Eliot Kimber ekimber@xxxxxxxxxxxx wrote:
>> I?m using Saxon 9.6.0.7 via Oxygen.
>>
>> I?m using xsl:result-document with @format to generate result documents.
>> If I use a variable reference in @format the referenced xml:output is
>> not used. If I replace the variable reference with a string literal I
>> get the expected output (in both cases the attribute is an attribute
>> value template).
>>
>> My initial code is:
>>
>> <xsl:result-documenthref="{$mapUri}"format="{$mapFormat}?>
>>
>>
>> Where $mapFormat has the string value ?map? and the ?map? output
>> declaration is present:
>>
>>
>> <xsl:paramname="mapFormat"as="xs:string"select="'map'?/>
>>
>>
>> <xsl:output name="map"
>>      method="xml"
>>      doctype-public="-//OASIS//DTD DITA Map//EN"
>>      doctype-system="map.dtd"
>>      indent="yes"
>> />
>>
>>
>> When I run this, the output is not used (result document has no DOCTYPE
>> decl and is not indented).
>>
>> If I replace format="{$mapFormat}? with format=?{?map?}? then I get the
>> expected result (DOCTYPE decl, indented markup).
>>
>> So the only difference is the use of the variable reference. I?ve
>> verified that $mapFormat has a value:
>>
>> <xsl:message>+ [DEBUG]
>> mapFormat="<xsl:sequenceselect="$mapFormat"/>"</xsl:message>
>>
>>
>> Which produces:
>>
>>
>> + [DEBUG] mapFormat=?map"
>>
>> It seems unlikely that this is a Saxon bug but I?m at a loss as to what
>> I could be doing wrong to cause this behavior.
>
>It looks like a bug to me, sample stylesheet is
>
><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>version="2.0">
>
><xsl:param name="map" select="'map'"/>
>
>  <xsl:output name="map"
>     method="xml"
>     doctype-public="-//OASIS//DTD DITA Map//EN"
>     doctype-system="map.dtd"
>     indent="yes"
>   />
>
>
><xsl:template name="main">
>   <xsl:result-document href="test2015122301Output.xml" format="{$map}">
>     <root>
>       <foo>bar</foo>
>     </root>
>   </xsl:result-document>
>   <xsl:result-document href="test2015122302Output.xml" format="{'map'}">
>     <root>
>       <foo>bar</foo>
>     </root>
>   </xsl:result-document>
></xsl:template>
>
></xsl:stylesheet>
>
>and the test2015122301Output.xml then looks like
>
><?xml version="1.0" encoding="UTF-8"?><root><foo>bar</foo></root>
>
>while the second is test2015122302Output.xml
>
><?xml version="1.0" encoding="UTF-8"?>
><!DOCTYPE root
>   PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
><root>
>    <foo>bar</foo>
></root>
>
>Tested with Saxon-HE 9.6.0.7J from Saxonica
>Java version 1.8.0_66

Current Thread