Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replacing with XSL

Status
Not open for further replies.

tokoh

Programmer
May 23, 2001
13
AU
I have an XML element that resembles the following;
<AccountNumber>123456 7</AccountNumber>

The value within the AccountNumber tag contains a space between the numbers (the 6 and 7 in the case above). I want to be able to use XSL to replace this whitespace with %20 so that I can place the contents of this tag into the URL and it be consistent in both Netscape and IE.

Does anyone know how this replace functionality can be done in XSL. I would prefer to do this in XSL rather than within a component, ASP or the like.
 
i don't know what a %20 is so i've just used &quot;-&quot; here.

if the account numbers are always of the same length then you could try...

<xsl:value-of select=&quot;substring(AccountNumber,1,6)/>-;
<xsl:value-of select=&quot;substring(AccountNumber,8,1)/>

or a neater solution

<xsl:value-of select=&quot;translate(AccountNumber,' ','-')&quot;/>

but i don't know if a space, &quot; &quot;, is aloud in the translate function.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top