[xsl] Binary to Hex conversion

Subject: [xsl] Binary to Hex conversion
From: Jeff Hooker <jeff@xxxxxxxxxxxx>
Date: Tue, 20 Nov 2007 14:12:35 -0800 (PST)
I'm sure I've seen this discussed somewhere, but the archive appears dry.

I have a binary value that is a result of concatenating the default values for a series of bits, and now I need to convert the complete value to hex so that I can display it as the "reset value" for the whole register. 

eg.

<bit>
    <bit_default>0</bit_default>
</bit>
<bit>
    <bit_default>1</bit_default>
</bit>
<bit>
    <bit_default>X</bit_default> <!--null bit-->
</bit>
<bit>
    <bit_default>1</bit_default>
</bit>

I gather them into a variable, substitute the Xs for 0s to allow for conversion to hex, and then..stop. I've searched for any math extensions that would allow an easy conversion to hex, but have come up dry, and I'm simply not up to the task of creating a recursive template to perform the conversion; on an 8000 page document it would likely still be running over the Christmas break. 

A register can be hundreds of bits in length, hence my desire to present the default settings in a more compressed format than their binary values.

Any suggestions?

Thanks,
Jeff.

Current Thread