Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old February 22nd, 2006, 09:05 PM
johkar
Guest
 
Posts: n/a
Default How to use translate() with HTML tags in string

I have a rather long unbroke string (a URL) which I would like to break
at certain points using XSL. I can't seem to get translate() to work:

translate(.,'/',,'<wbr>/</wbr>')

I don't know that the <wbr> tag is valid, but if can stick something
within the string I think I can figure out a way for it to wrap.

  #2  
Old February 23rd, 2006, 04:25 AM
Joe Kesselman
Guest
 
Posts: n/a
Default Re: How to use translate() with HTML tags in string

> translate(.,'/',,'&lt;wbr>/&lt;/wbr>')

translate() performs character-to-character mapping, not
character-to-string. See
http://www.w3.org/TR/1999/REC-xpath-...tion-translate

So as you've written it -- assuming the double comma is just a typo --
you've said "Retrieve the text value of the current node (.), find all
instances of '/', and replace them with the '<' character (&lt;)".

If you're trying to replace instances of / with <wbr>/</wbr>, this won't
do it. See recent discussions of using the substring functions, and
recursive templates if necessary, to achieve this... and you probably
want to insert a real <wbr> element rather text which describes one.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
  #3  
Old February 25th, 2006, 12:05 PM
johkar
Guest
 
Posts: n/a
Default Re: How to use translate() with HTML tags in string


Joe Kesselman wrote:[color=blue][color=green]
> > translate(.,'/',,'&lt;wbr>/&lt;/wbr>')[/color]
>
> translate() performs character-to-character mapping, not
> character-to-string. See
> http://www.w3.org/TR/1999/REC-xpath-...tion-translate
>
> So as you've written it -- assuming the double comma is just a typo --
> you've said "Retrieve the text value of the current node (.), find all
> instances of '/', and replace them with the '<' character (&lt;)".
>
> If you're trying to replace instances of / with <wbr>/</wbr>, this won't
> do it. See recent discussions of using the substring functions, and
> recursive templates if necessary, to achieve this... and you probably
> want to insert a real <wbr> element rather text which describes one.
>
> --
> () ASCII Ribbon Campaign | Joe Kesselman
> /\ Stamp out HTML e-mail! | System architexture and kinetic poetry[/color]

Thanks for the info. I found the threads on substrings and have it
working.

 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles