xsl-list
[Top] [All Lists]

RE: [xsl] xmlns created literally

2009-02-26 07:35:11
The stylesheet is an XDM instance. Therefore the XSLT processor does not see
an attribute xmlns="{$x}", it sees a namespace node whose name is "" and
whose string value is "{$x}".

Attribute value templates don't come into it. There is no attribute, so
there can be no AVT. Namespaces are not attributes.

XSLT could have defined a rule that namespace URIs within the stylesheet
must not contain curly braces. But it would be a rather curious rule: it's
for XML to define what's allowed in a namespace URI, not for XSLT.

I think the output that shows the namespace URI percent-encoded is wrong. I
can't see any justification for percent-encoding a namespace URI under any
circumstances.

Michael Kay
http://www.saxonica.com/


-----Original Message-----
From: jesper(_dot_)tverskov(_at_)gmail(_dot_)com 
[mailto:jesper(_dot_)tverskov(_at_)gmail(_dot_)com] On Behalf Of Jesper 
Tverskov
Sent: 26 February 2009 11:17
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] xmlns created literally

We are allowed to create xmlns or xmlns:* the literal way, 
but we can apparently not use attribute value template for 
the namespace. This is probably not that surprising since we 
cannot create xmlns or xmlns:* with xsl:attribute.

But it surprices me that we don't get an error message. The 
following stylesheet is tested with Saxon 9 in Oxygen and 
with AltovaXML 2009 in
XMLSpy:

<xsl:stylesheet version="2.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
    <xsl:output indent="yes"/>
    <xsl:template name="start" match="/">
        <xsl:param name="x" select="'asdf'"/>
        <catalog>
            <product xmlns="asdf">some data</product>
            <product xmlns="{$x}">some data</product>
        </catalog>
    </xsl:template>
</xsl:stylesheet>

We get the following output in Oxygen:

<catalog>
   <product xmlns="asdf">some data</product>
   <product xmlns="{$x}">some data</product> </catalog>

And the following output in XMLSpy:

<catalog>
<product xmlns="asdf">some data</product> <product 
xmlns="%7B$x%7D">some data</product> </catalog>

The one even more strange than the other! Should it have been 
an error message instead? Or should the attribute value template work?


Cheers,
Jesper Tverskov

http://www.xmlkurser.dk
http://www.xmlplease.com

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

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