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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replacing text with xsl

Status
Not open for further replies.

Lucefirus

Programmer
Dec 28, 2004
6
US
i am outputting contents of an xml file into html via xsl. for instance, i have a <block> tag and in it there is an <lnk> tag such as this: <block>content goes <lnk name=linktowherever>here</lnk></block>, i print out the block contents with the value-of tag, but how do i replace those lnk tags so that they become themselves a link.
 
HTML and XML arnt exactly mix-able, what I've actually done is with PHP , replace certain characters, for example a link.

!LTa href='
then in PHP doing

Code:
$result = str_replace("!LT", "<", $result);
$result = str_replace("!GT", ">", $result);
echo $result;

Course $result is the HTML once I've parsed it thru the XSL engine, then I'm just replacing tokens with the values desired. This is a server-sided method to solving the problem above, Client-sided I'm not really sure except maybe thru Javascript, and I think that might be a bit more troublesome. You could even try making a template in XSL to go one step further but as far as where the link shows up or in what order I dont know.

Karl Blessing
PHP/MySQL Developer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top