473,395 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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.

Feb 22 '06 #1
2 1501
> 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
Feb 23 '06 #2

Joe Kesselman wrote:
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


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

Feb 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: lkrubner | last post by:
I'd like to write a PHP script to be used from the command line on a Unix machine. I'd like for the script to put together a string, turn it into a web page, print it, then return control the...
1
by: kennethfine | last post by:
I'm transitioning from ASP development, please excuse these basic questions. One thing I did often in ASP was create a "translate" function to render one string to another, strip out excess...
3
by: Alex | last post by:
Hello. First, with AJAX I will get a remote web page into a string. Thus, a string will contain HTML tags and such. I will need to extract text from one <span> for which I know the ID the inner...
9
by: anupamjain | last post by:
Hi, After 2 weeks of search/hit-and-trial I finally thought to revert to the group to find solution to my problem.(something I should have done much earlier) This is the deal : On a JSP...
3
by: Just D. | last post by:
All, What's the simplest way to show my own HTML string on the ASPX page assuming that this page is just created using the wizard and it has nothing on it? We're free to use any control adding...
7
by: Xah Lee | last post by:
Summary: when encountering ex as a unit in css, FireFox (and iCab) did not take into account the font-family. Detail: http://xahlee.org/js/ff_pre_ex.html Xah xah@xahlee.org ∑...
1
by: since | last post by:
I figured I would post my solution to the following. Resizable column tables. Search and replace values in a table. (IE only) Scrollable tables. Sortable tables. It is based on a lot...
4
by: destroooooy | last post by:
Hi folks, I'm finding some (what I consider) curious behavior with the string methods and the forward slash character. I'm writing a program to rename mp3 files based on their id3 tags, and I want...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.