This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Attribute default values (using SAXON/XALAN/MSXML) --BUG in MSXML?--
- To: "'xsl-list-digest at lists dot mulberrytech dot com'" <xsl-list-digest at lists dot mulberrytech dot com>
- Subject: [xsl] Attribute default values (using SAXON/XALAN/MSXML) --BUG in MSXML?--
- From: Eric Vermetten <EVermetten at nl dot alpnet dot com>
- Date: Sun, 21 Jan 2001 20:16:27 -0000
- Reply-To: xsl-list at lists dot mulberrytech dot com
using: SAXON 6.0.2 and msxml production release and XALAN-j 1.2.2
Hello all,
I really need to get hold of DTD defined attribute values.
I have the following stylesheet and two XML files:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="yes" encoding="UTF-8" />
<xsl:variable name='global'> <!-- I really like to get the attributes here!
-->
<xsl:value-of select='count(//x/@*)' />
</xsl:variable>
<xsl:template match="x" >
<xsl:variable name='from-global' select="count(//x/@*)" />
<xsl:variable name='from-current' select="count(@*)" />
<out>
<xsl:value-of select="$global" /><xsl:text>|</xsl:text>
<xsl:value-of select="$from-current"
/><xsl:text>|</xsl:text>
<xsl:value-of select="$from-global" />
</out>
</xsl:template>
</xsl:stylesheet>
++++++++++++++XML:mail.txt+++++++++++++++++++++++++
<?xml version='1.0' encoding='UTF-8' ?>
<x e='1' a='2'></x>
++++++++++++++XML:mail2.txt+++++++++++++++++++++++++
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE x [
<!ELEMENT x EMPTY >
<!ATTLIST x e CDATA #FIXED '1'
a CDATA #FIXED '2' >
]>
<x/>
XALAN and SAXON always give: <out>2|2|2</out>
msxml gives <out>2|2|2</out> on mail.txt and <out>0|2|0</out> on mail2.txt
Reading section 3.3.2 on attribute default values of the XML-rec I
conclude that I should *always* get output '2|2|2' as content of <out>.
Is this right? So is this another bug in msxml?
For the job at hand I'm bound to msxml,
so if in error, is there a work around?
Thanks in advance,
Eric Vermetten
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list