[xsl] result-document, QNames, AVT's, format-attribute and use-character-maps attribute

Subject: [xsl] result-document, QNames, AVT's, format-attribute and use-character-maps attribute
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Thu, 14 Dec 2006 13:33:43 +0100
Hi All,

Excuses up front for asking three questions at once, but I believe they are related, so here it goes:

In my import/export application, I need support for multiple output. Also, users can specify (using externalized xsl:param) what options to use on serializing. xsl:output only has literal values as attributes, while xsl:result-document has AVTs (attribute value templates), for dynamic overriding of the values specified in the xsl:output. So far so good. The questions:

Q1: why does the QName of the format-attribute raise an error is specified as literal AVT? I use Saxon 8.8.
Example:
<xsl:result-document href="xyz.xml" format="{ 'test' }">
....sequence....
</xsl:result-document>
Error: Invalid QName {{'test'}}see XTDE1460


It puzzles me, that xsl:attribute, which has the same AVT datatype for a the name-attribute, does not behave in the same way. The error does not occur on the similar attribute cdata-section-elements. Also, the error is gone when using the following workaround: 1) format = " string ( 'test' ) "
2) format = " xs:QName ( 'test' ) "


Q2: Is there any plausible reason why all attributes have become AVTs, with the exception of use-character-maps (and validation/type, but that sounds sensible)? I really want a user-specifiable filter for result trees, but it does not appear to be possible (unless: I create one xsl:output per filter, or combination of filters, and use the format-attribute). The specs says so as well. Am I correct?

Q3: Though an serialization can be mapped with a character map, is anyone aware of a similar function with "importing" data? Like, with the doc()/document() functions, or, better yet, with the unparsed-text() entry? Or should I stick with extension functions? (reason: I want to strip or replace unparsable bytes from the input stream before it gets to the XSLT processor, which would reject any \x00 and, depending on version, other control characters).

Any help or light on the subject is greatly appreciated,

Thanks,

Abel Braaksma
Nuntia B.V.

Current Thread