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

Re: Newbie: using translate

Subject: Re: Newbie: using translate
From: "Hugo Ferreira" <hmf@xxxxxxxxxxxxx>
Date: Mon, 18 Mar 2002 11:01:08 -0000
hugo ferreira
Jarno,

Thanks a million for the answer. This solved my problem.
I am still confused though. You say that I cannot "alter 
alter the value of $field."

This line changes (read translates) the content of "$field" node

<xsl:value-of select="translate($field, ',', '.')" />

If however I want ot change the value of  $field variable,
how would I do that? Why the stupid question? I thought
that if 
    $field = "A,text,string"

then 
    translate($field, ',', '.') 

would be equivalent to 
    translate("A,text,string", ',', '.')

which would ultimately result in:
<xsl:value-of select="A.text.string" />


TIA.
Hugo.

----- Original Message ----- 
From: <Jarno.Elovirta@xxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, March 18, 2002 10:19 AM
Subject: RE:  Newbie: using translate


> > I am using the following template:
> > 
> >  <xsl:template name="number-1-block">
> >   <xsl:param name="field"/>
> >   <xsl:if test="not(string($field))">NULL</xsl:if>
> >   <xsl:if test="string($field)"><xsl:value-of 
> > select="$field"/></xsl:if>
> >  </xsl:template>
> > 
> > The $field" variable is a float that uses the "," as a 
> > decimal seperator.
> > Can anyone give me an example of how I can use "translate()" to change
> > the "," to a "." The examples I have found use the 
> > "translate" function
> > in the following manner:
> > 
> > <xsl:value-of select="translate(.,',.','')"/>
> > 
> > But I don't want the current node's value (".") but need the 
> > "$field"'s
> > value
> > to be altered.
> 
> You can't alter the value of $field.
> 
> <xsl:template name="number-1-block">
>   <xsl:param name="field" />
>   <xsl:choose>
>     <xsl:when test="string($field)">
>       <xsl:value-of select="translate($field, ',', '.')" />
>     </xsl:when>
>     <xsl:otherwise>NULL</xsl:otherwise>
>   </xsl:choose>
> </xsl:template>
> 
> santtu
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.