Subject: [xsl] How to fuzz the last four digits of a lat/long? From: "Roger L Costello costello@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Sat, 22 May 2021 13:09:38 -0000 |
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="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 the 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() function, right? Ditto for the longitude transformation. /Roger
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Transform selected attrib, Sam Spade anonymousj | Thread | Re: [xsl] How to fuzz the last four, Michael Kay mike@xxx |
Re: [xsl] Transform selected attrib, Martin Honnen martin | Date | Re: [xsl] How to fuzz the last four, Michael Kay mike@xxx |
Month |