[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Need help with function to split string and return co

Subject: Need help with function to split string and return concatenated string
From: cknell@xxxxxxxxxx
Date: Thu, 06 May 2010 18:41:01 -0400
 Need help with function to split string and return  co
I'm still knocking the rust off my brain and I've go to the point where I wish to split the value of an attribute and concatenate the pieces to return a second string.

I have attributes in my input document which represent latitude and longitude. They are presented this way:

34.56.12 N

Where the digits to the left of the first period represent degrees, the digits between the two periods represent minutes, and the digits between the second period and the space represent seconds.

The output I'm looking for given the input above is

34deg 56min 12sec N

While I used to be a wiz with regular expression when I regularly programmed in perl, I have lost it. I would appreciate some guidance.

My idea is to create a function that would perform this string manipulation so that I could use something like this in my stylesheet:

<Data><xsl:value-of select="coord(@latitude)"/></Data>
<Data><xsl:value-of select="coord(@longitude)"/></Data>

My input would look like:

<location latitude="34.56.12 N" longitude="125.6.15 E"/>

Thanks.

-- 
Charles Knell
cknell@xxxxxxxxxx - email

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.