xsl-list
[Top] [All Lists]

Re: [xsl] Attribute constructor for @xml:id

2017-02-07 13:31:18
This problem is envisaged in the XSLT spec. See §11.1.2:

The xml:base, xml:lang, xml:space, and xml:id attributes have two effects in 
XSLT. They behave as standard XSLT attributes, which means for example that if 
they appear on a literal result element, they will be copied to the result tree 
in the same way as any other attribute. In addition, they have their standard 
meaning as defined in the core XML specifications. Thus, an xml:base attribute 
in the stylesheet affects the base URI of the element on which it appears, and 
an xml:space attribute affects the interpretation of whitespace text nodes 
within that element. One consequence of this is that it is inadvisable to write 
these attributes as attribute value templates: although an XSLT processor will 
understand this notation, the XML parser will not. See also 11.1.4 Namespace 
Aliasing which describes how to use xsl:namespace-alias with these attributes.

Michael Kay
Saxonica


On 7 Feb 2017, at 17:15, Martin Holmes 
gtxxgm-xsl-list-2(_at_)m(_dot_)gmane(_dot_)org 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

Hi all,

I just hit a problem uploading what I thought was good XSLT 2.0 into 
exist-db. This is what the problem looks like:

<xsl:variable name="xmlSource">
  <div type="ajaxFragment" xml:id="{$thisId}" n="{$sortKey}">
    <head><xsl:value-of select="$citationCaption"/></head>
       [...]
  <div>
</xsl:variable>

eXist's XML parser complains that the @xml:id is not a valid NCName, which of 
course it's not, but I hadn't until now considered the possibility that is-id 
constraints might apply to this kind of constructor in output content. Some 
on the eXist list have suggested that this is invalid XSLT, but Saxon has 
never complained about it and I can't actually find anything in the spec that 
clearly says so. There's an obvious workaround using the more verbose 
constructor, but I'd like to know whether this is in fact technically wrong 
or not. What say you?

Cheers,
Martin

--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>