This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Newbie question with XSL and functions
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: Newbie question with XSL and functions
- From: Linda van den Brink <lvdbrink at baan dot nl>
- Date: Thu, 15 Jun 2000 16:04:41 +0200
- Reply-To: xsl-list at mulberrytech dot com
> I am new to using XSL and have a question. I have a
> conversion that I need
> to do over and over again on a certain type of data through-out my
> stylesheet. I was wondering if there is a concept of a
> function in XSL that
> I can pass in some text and get it back formatted in a
> different way. If
> there is, could I get sometype of example code segment or a
> link of where I
> might be able to find something on-line. The conversion I
> need to do is to
> transform a decimal degrees value to a degrees:minutes:second format.
I'd probably create a named template like this:
<xsl:template name="formattext">
do the transform here
</xsl:template>
And call this template whenever I needed it like this:
<xsl:call-template name="formattext"/>
You could pass in the text you want to transform as a variable using
xsl:with-param.
The exact code you would use for the transforming itself depends on the way
your input strings look and the output you want (and keep in mind that I
don't know what a decimal degrees value looks like), but a whole set of
string functions as well as the translate function is available within XSLT.
Have a look at them...
Linda
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list