How to fuzz the last four digits of a lat/long?

"Roger L Costello [email protected]" <[email protected]> Sat, 22 May 2021 13:09:48 -0000
Newsgroups gmane.text.xml.xsl.general.mulberrytech
Message-ID <[email protected]>
Hi Folks,

I want to transform this location data:

<location>
    <altitude>30000</altitude>
    <latitude>42.364978</latitude>
    <longitude>-71.022362</longitude>
</location>

to this:

<location>
    <altitude>30000</altitude>
    <latitude>42.360000</latitude>
    <longitude>-71.020000</longitude>
</location>

That is, I want to map the altitude value directly and for the latitude and=
 longitude values I want to fuzz them by setting their last four digits to =
zero.

I can do the latitude transformation in two steps:

1. Use format-number() to truncate the number to two digits to the right of=
 the decimal point.

2. Use concat() to append '0000'.

That is:

<latitude>
    <xsl:value-of select=3D"concat(format-number(latitude, '0.00'), '0000')=
" />
</latitude>

But, but, but, ....

I really want to do the transformation in one step. Is there a way to do th=
e transformation in one step (using the built-in XSLT or XPath functions)? =
As best I can tell, I can't do it in one step using the format-number() fun=
ction, right?

Ditto for the longitude transformation.

/Roger
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/3329386
or by email: [email protected]
--~--