[xml] language-lawyer question: namespace precedence rules for attributes?



Hello:

Using libslt 1.0.27 and the following transformer:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
 <xsl:output method = "xml" indent="no" omit-xml-declaration="yes"/>
 <xsl:template match="/">
   <result>
<xsl:attribute name="foo" namespace="http://some-ns/";>bar</xsl:attribute> <xsl:attribute name="x:foo" xmlns:x="http://some-ns/";>baz</xsl:attribute> <xsl:attribute name="y:bar" xmlns:y="http://some-ns/";>baz</xsl:attribute> <xsl:attribute name="z:yow" xmlns:z="http://some-ns/";>baz</xsl:attribute> <xsl:attribute name="a:mum" xmlns:a="http://some-ns/";>baz</xsl:attribute> <xsl:attribute name="b:zip" xmlns:b="http://some-ns/";>baz</xsl:attribute> <xsl:attribute name="c:zap" xmlns:c="http://some-ns/";>baz</xsl:attribute>
  </result>
 </xsl:template>
</xsl:stylesheet>

on a simple xml file   <dummy/>

I get the following result:

<result xmlns:ns1="http://some-ns/"; ns1:foo="baz" ns1:bar="baz" ns1:yow="baz" ns1:mum="baz" ns1:zip="baz" ns1:zap="baz"/>

In other words
1- the *first* prefix for a duplicated namespace wins
2- the *last* value for a duplicated attribute wins

This seems fairly reasonable, but I can't find any basis in the W3C spec for heuristic #1. Can anyone offer me any pointers as to the letter of the W3C law on this point?

Thanks in advance,

--Craeg




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]