turugina #7312(2008/08/24 20:52 GMT) [ XSLT ] Rating0/0=0.00
一応YiBまで対応(処理系が対応してればだけど. 変換対象のバイト数はスタイルシートパラメタnで与えます。 449bytes, 実質443bytes
1 2 3 4 5 6 7 8
<transform version="2.0" xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:y="y"> <output method="text"/><param name="n"/> <variable name="u" select="('B','KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB')"/> <template match="/"><value-of select="y:f($n,1)"/></template> <function name="y:f"><param name="m"/><param name="i"/> <sequence select="if($m<1024)then($m,$u[$i])else y:f(round-half-to-even($m div 1024,2),$i+1)"/> </function></transform>
Rating0/0=0.00-0+
1 reply [ reply ]
turugina
#7312()
[
XSLT
]
Rating0/0=0.00
<transform version="2.0" xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:y="y"> <output method="text"/><param name="n"/> <variable name="u" select="('B','KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB')"/> <template match="/"><value-of select="y:f($n,1)"/></template> <function name="y:f"><param name="m"/><param name="i"/> <sequence select="if($m<1024)then($m,$u[$i])else y:f(round-half-to-even($m div 1024,2),$i+1)"/> </function></transform>Rating0/0=0.00-0+
1 reply [ reply ]