Link to home
Start Free TrialLog in
Avatar of shuittny
shuittny

asked on

find and replace in xsl

I have field data that looks something like this within my "teams" column

<div> SF. Giants </div>
<b> NY Mets </b>
<div><i> MLB </i></div>

I'm using XML to parse through the data and I want to know if its possible within XSL to replace the <div>, </div>, <b>, etc. tags and replace them with a NULL or whitespace.  Is this possible?

ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of shuittny
shuittny

ASKER

what if <b>NY Mets</b> is the value of a field such as <xsl: value-of select=@team/>?  Would the response still hold?
No, that would be a lot different of course
XSLT is mainly about transforming structure,
so if you post an XML as you did, one can safely assume taht you mean structure transformation

Anyway, you need some regular expression processing.
What do you want to happen, remove all occurences of tags from string?

It is possible, but it is quiet a more difficult task than you originally had
I'll explain (probably should have done this previously)

I'm creating a formpage and on this page I have a richtext textarea field (let's call it baseball teams) in which users can bold, italicize, change text color, etc. (in IE). When the user access a reports page the field info. is extracted however it pulls the HTML tags within the field. So if the user has bold text, the reference tag will appear as part of the value even though the user never physically typed the tag, they just bolded the text. Ditto with changing colors, italicizing, making bullets, etc. I believe its because the tags are embedded and sent to the db before having a chance to be filtered out (and no I don't have real access to the db). Anyhow when I pull the information into another page the tags are embedded when in reality I want them removed.
OK, I see, can you use XSLT2?
If not, I will have to work on an XSLT1 recursive template for dealing with this, that is quite a bit harder