xslweb icon indicating copy to clipboard operation
xslweb copied to clipboard

Using resp:response to download xml transfers name-space declarations

Open siebej opened this issue 3 years ago • 0 comments

Using resp:response to download xml transfers name-space declarations.

input-xml: see input.xml in input.xml.zip input.xml.zip

request-dispatcher.xsl template

  <xsl:template match="/req:request[req:path = '/issueMetNamespaces']">
    <pipeline:transformer name="issueMetNamespaces" xsl-path="issueMetNamespaces.xsl"/>
  </xsl:template>

issueMetNamespaces.xsl:

<?xml version='1.0'?>
<xsl:stylesheet 
	version="3.0" xmlns:xsl  ="http://www.w3.org/1999/XSL/Transform" xmlns:resp="http://www.armatiek.com/xslweb/response" exclude-result-prefixes="#all">
  <xsl:template match="/">
    <xsl:variable name="input" as="document-node()"  select="doc('input.xml')"/>

    <xsl:result-document href="file-uri2output-saxon.xml">
      <xsl:sequence select="$input"></xsl:sequence>
    </xsl:result-document>

    <resp:response status="200">
      <resp:headers>
        <resp:header name="Content-Type">application/xml</resp:header>
        <resp:header name="Content-Disposition">attachment; filename=output-response.xml</resp:header>
      </resp:headers>
      <resp:body>
        <xsl:sequence select="$input"/>
      </resp:body>
    </resp:response>
  </xsl:template>
  
</xsl:stylesheet>

The result of saxon-result-document: output-saxon.xml.zip

The result of response: output-response.xml.zip

I get that both files are valid.

But MsWord does not like it.

siebej avatar Nov 15 '22 12:11 siebej