You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Sc...@lotus.com on 2001/03/11 22:25:59 UTC

Attribset24 re-prefixes attributes, but I don't think it should

The gold for attribset24 re-prefixes the attributes when a valid prefix can
be created from the name attribute.  Given the philosophy that
xsl:attribute and xsl:element should not change the prefix given in the
name attribute unless it absolutely has to, I think it is better for the
processor to use the prefixes given in the name attribute.

== attribset24.xml==
<?xml version="1.0"?>
<docs>
  <a>xyz:Attr1</a>
  <b>bdd:Attr2</b>
</docs>

== attribset24.xsl ==
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version
="1.0"
                    xmlns:ped="http://ped.test.com"
                    xmlns:bdd="http://bdd.test.com">

<xsl:output indent="yes"/>

  <!-- FileName: attribset24 -->
  <!-- Document: http://www.w3.org/TR/xslt -->
  <!-- DocVersion: 19991116 -->
  <!-- Section: 7.1.3 Creating Attributes -->
  <!-- Creator: Paul Dick -->
  <!-- Purpose: The namespace attribute is interpreted as an attribute
value template. -->

<xsl:template match="/">
 <root>
  <Out>
     <xsl:attribute name="{docs/a}" namespace
="http://ped.test.com">YoBaby</xsl:attribute>
     <xsl:attribute name="{docs/b}" namespace
="http://ped.test.com">jaminben</xsl:attribute>
  </Out>
 </root>
</xsl:template>

</xsl:stylesheet>

== gold attribset24.out ==
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:bdd="http://bdd.test.com" xmlns:ped="http://ped.test.com">
<Out ped:Attr1="YoBaby" ped:Attr2="jaminben"/>
</root>

Notice that the prefixes on both attributes have been changed to ped, which
I think is not desirable (though possibly conformant to the spec).  Saxon
and XT also both do this.

I think the correct output (or better output) should be:

<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:bdd="http://bdd.test.com" xmlns:ped="http://ped.test.com">
<Out xmlns:xyz="http://ped.test.com" xyz:Attr1="YoBaby" bdd:Attr2
="jaminben"/>
</root>

Which keeps the original prefixes.  Why should the prefixes be changed if
you don't have to??  In both output cases, the resolved name of the node is
the same.

Until we get this resolved, I'm going to change my local gold to use the
second output method, and test against that (I'm in the process of fixing
the behavior of xsl:attribute to be consistent with the fixed behavior of
xsl:element which we did a couple of months ago).

I should say that usually I aim for consistency with XT and Saxon (and
hopefully other processors), but this is one case where I feel my way is
semi-significantly better, and I want to keep the behavior very consistent
with xsl:element.

-scott