Add two hexBinarys with XPATH 1.0

Posted by fielding on Stack Overflow See other posts from Stack Overflow or by fielding
Published on 2010-06-16T06:55:31Z Indexed on 2010/06/16 7:02 UTC
Read the original article Hit count: 174

Filed under:
|
|
|
|

Hi, my xml document looks somewhat like that (Values are both xsl:hexBinary):

<Offsets>  
    <Offset>  
        <Name>ErrorOffset</Name>  
        <Value>DD</Value>  
    </Offset>  
    <Offset>  
        <Name>OtherOffset</Name>  
        <Value>FF</Value>  
    </Offset>  
</Offsets>  
<Value>  
    <Name>Error1</Name>  
    <Code>01</Code>  
</Value>
<Value>  
    <Name>Error2</Name>  
    <Code>02</Code>  
    <Offset>ErrorOffset</Offset>  
</Value>

now i want to transform this to a new xml file:

<Value>  
    <Name>Error1</Name>  
    <Code>01</Code>  
</Value>
<Value>  
    <Name>Error2</Name>  
    <Code>DF</Code>  
</Value>

All that should happen is adding <Offset> to the basic <Value>. But plain + returns NaN and sum() expects only one parameter. XSLT and XPATH are quite nice, but it goes on my nerves that easy operations like adding two hex values just dont work as easy as it should.

© Stack Overflow or respective owner

Related posts about xslt

Related posts about xpath