[xsl] Correct handling of namespaces with Sablotron?

Subject: [xsl] Correct handling of namespaces with Sablotron?
From: Charles Turner <vze26m98@xxxxxxxxx>
Date: Mon, 16 Jan 2012 07:28:52 -0500
Hi everyone-

I'm a newbie with respect to XML/XSLT, and am currently working on a
project to synchronize data between Adobe InDesign and Filemaker via
XML. I'm currently having trouble with the way I handle namespaces
importing to InDesign, where the internal XSLT processor is (I'm
pretty sure) Sablotron. (I believe Filemaker uses Xalan.) My current
solution works as I want with the libxslt/xsltproc that comes with OSX
Lion, but Sablotron/InDesign seems to add namespaces to the elements
I'm creating.

My examples are abbreviated to show the issue, but actually work.

Here's my original XML:

<?xml version="1.0" encoding="UTF-8"?>
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult";>
	<PRODUCT BUILD="07-18-2011" NAME="FileMaker" VERSION="ProAdvanced 11.0v4"/>
</FMPXMLRESULT>

And here is the XSLT I've written:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fmp="http://www.filemaker.com/fmpxmlresult"; version="1.0"
exclude-result-prefixes="fmp">
  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  <xsl:template match="fmp:FMPXMLRESULT">
    <xsl:element name="FMPXMLRESULT"
namespace="http://www.filemaker.com/fmpxmlresult";>
      <xsl:copy-of select="fmp:PRODUCT"/>
    </xsl:element>
  </xsl:template>
</xsl:stylesheet>

What I'd like to get back, in what is shown, is a simple an exact copy
of my input, but InDesign/Sablotron gives me:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns_1:FMPXMLRESULT xmlns:ns_1="http://www.filemaker.com/fmpxmlresult";>
	<PRODUCT xmlns="http://www.filemaker.com/fmpxmlresult";
VERSION="ProAdvanced 11.0v4" NAME="FileMaker" BUILD="07-18-2011"/>
</ns_1:FMPXMLRESULT>

Where the output of <xsl:copy-from> is handled correctly (although an
xmlns attribute is added), but the output of <xsl:element> adds the
impromptu namespace of +ns_1;.

I've Googled and searched the list archives, and found one suggestive
thread, but so far no joy. Any pointers on Sablotron and or my lack of
understanding would be greatly appreciated.

Best wishes,

Charles Turner

Current Thread