xsl-list
[Top] [All Lists]

[xsl] Binary to Hex conversion

2007-11-20 15:13:13
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.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>