Hi all,
First of all, apologies if this is a newbie question (couldn't find
anything similar in the archives or faq, though).
I've stumbled upon a problem regarding xsl:variable and using this
variable in an xsl:copy-of element. It seems that Xalan-C 1.3 ignores
attributes defined in the variable if these attributes have a value of
"", i.e. an empty string.
Example:
--------
Stylesheet:
-----------
<?xml version ="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/Request">
<xsl:copy-of select="$Info"/>
</xsl:template>
<xsl:variable name="Info">
<InsertedInfo attribute1=""/>
</xsl:variable>
</xsl:stylesheet>
xml file:
---------
<?xml version ="1.0"?>
<Request>
</Request>
Passing the above stylesheet to XalanTransformer::compileStylesheet( )
and the xml file to XalanTransformer::transform( ) results in:
<?xml version="1.0" encoding="UTF-8"?>
<InsertedInfo/>
i.e. the Attribute attribute1 of node InsertedInfo is missing.
If, however, attribute1 contains some value, e.g. a blank
<xsl:variable name="Info">
<InsertedInfo attribute1=" "/>
</xsl:variable>
the output is
<?xml version="1.0" encoding="UTF-8"?>
<InsertedInfo attribute1=" "/>
i.e. the attribute is there.
Trying the same with Xalan-J 2_2_D14, the attribute is always there, no
matter whether it's value is "" or " ".
I have to admit that I don't know whether this really is a Xalan-C or a
Xalan-J problem or rather the Xalan-C developers interpreting the XSLT
1.0 standard http://www.w3c.org/TR/xslt (especially sections 11.2 and
11.3) differently from the the Xalan-J developers. Or quite simply me
abusing xslt and/or xalan in some way.
Any clues?
Tom
PS: I'm using Xalan-C 1.3, Xerces-C 1.6 on Sun Solaris 2.6, both
compiled myself with Sun Workshop 6.2 (aka Forte 6.2).
__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com