operands are changing
User-Agent: KNode/0.7.2

Hi,

I have a little situation that I need someone to explain to me - it appears
that the result of a simple subtraction remains the same although the
operands are changing.  I'm slowly losing my hair, so perhaps if someone
could lend a fresh pair of eyes? 
It also *appears* to have to do with one of my own extensions functions, but 
I'm not sure. 
(this is with xerces 2.5.0 and xalan 1.7.0, both CVS snapshots from 4 Apr).

It's a fairly simple function that does some string manipulation and returns :

return executionContext.getXObjectFactory().createString( result );  
(result being a XalanDOMString)

Look at the xml-output here and the xsl further down - how is it possible that 
'a' clearly 
has 2 different values, yet a1='$a - 0' is the same in both cases?? 

output:

<?xml version="1.0" encoding="UTF-8"?>
<k1 a="1078242930" a1="1078242930" b="1078242930">1078242930</k1>
<k1 a="1078250024" a1="1078242930" b="1078242930">1078242930</k1>

The reason I suspect my own extension is - if I instead of using the tx: 
function just assign 
a straight number to 'a', everything works fine. If anyone can help me get on 
with this, I'd 
much appreciate it.


thanks,
Per Jessen, Zurich


xml:

<?xml version="1.0" encoding="UTF-8"?>
<contents>
<email received="20040302165530"></email>
<email received="20040302185344"></email>
</contents>

xsl:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY sp "<xsl:text> </xsl:text>">
<!ENTITY nl "<xsl:text>&#10;</xsl:text>">
]>

<xsl:stylesheet version="1.0"
        exclude-result-prefixes="#default tx"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns:tx="http://timian.jessen.ch/extensions";
        xmlns="">

<xsl:output
        method="xml"
        omit-xml-declaration="no"
        version="1.0"
        encoding="utf-8"
        indent="no"/>

<xsl:template match="/">

        <xsl:apply-templates select="contents/email">
        </xsl:apply-templates>

</xsl:template>

<xsl:template match="email">

        <xsl:variable name="a" select="tx:strftime('%s',@received)"/>
        <xsl:variable name="b" select="$a - 0"/>

        <k1 a="{$a}" a1="{$a - 0}" b="{$b}"><xsl:value-of select="$a - 
0"/></k1>&nl;

</xsl:template>

</xsl:stylesheet>



Reply via email to