[xquery-talk] Omit namespace attributes in output file

Michael Kay mike at saxonica.com
Wed Apr 19 02:38:31 PDT 2017


XQuery output has to be well-formed (and namespace-well-formed) XML, so you can't output an element name like <ac:emoticon> unless the "ac" prefix is declared and bound to a namespace URI. Why would you want to? Does Confluence really use non-namespace-aware XML?

Michael Kay
Saxonica

> On 19 Apr 2017, at 09:51, xquery at docbook-autor.de wrote:
> 
> 
> Hi,
> 
> I’m transforming some DocBook data into an XML file using XQuery. The
> transformation works perfectly so far.
> 
> My problem is, that I have to use some confluence namespace tags like
> <ac:emoticon ac:name=“warning” /> in the XML output file.
> 
> So I have to declare the respective namespace at the beginning of my
> XQuery file:
> 
> ###
> xquery version "1.0" encoding "utf-8";
> 
> declare namespace db="http://docbook.org/ns/docbook";
> declare namespace saxon="http://saxon.sf.net/";
> declare namespace ac="https://www.atlassian.com/schema/confluence/6/ac";
> 
> declare option saxon:output "version=1.0";
> declare option saxon:output "omit-xml-declaration=yes";
> declare option saxon:output "indent=yes";
> ###
> 
> Because of the namespace declaration for "ac" at the beginning the
> transformation results in this:
> 
> ###
> <ac:emoticon xmlns:ac="https://www.atlassian.com/schema/confluence/6/ac"
> ac:name="warning"/>
> ###
> 
> Without this declaration the transformation stops with an error message
> that a declaration for namespace “ac” is missing.
> 
> Is it possible to omit the xmlns:ac attribute somehow?
> 
> Thanks in advance!
> 
> Regards
> Michael
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk




More information about the talk mailing list