xsl-list
[Top] [All Lists]

RE: Replacing specific acronyms in output

2004-02-13 01:42:10
Hi,

I also have an XML list of acronyms used throughout my journal,
formatted thus:
<acronyms>
  <acronym acronym="CSS">Cascading Style Sheet</acronym> 
  <acronym acronym="CGI">Common Gateway Interface (web scripting
facility) or Computer-Generated Imagery (movie industry)</acronym>
  ...
</acronyms>

I wish to be able to automatically replace any occurrence of 
an acronym
in the XHTML output with the appropriate XHTML <acronym 
title="Cascading
Style Sheet">CSS</acronym> tag.

This is normal search and replace, see the FAQ 
<http://www.dpawson.co.uk/xsl/sect2/replace.html>. It would make your life 
easier, though, if you marked up the arconyms in your source with the XHTML 
element "acronym" without the title and then just add the "title" attribute.

I have thought about it and I can't think of any way to do this that
wouldn't involve parsing my journal and on every single word of my
journal, parsing every single acronym in my acronyms list - thus for
every word in my journal my entire acronym list would be parsed -
something I assume would be highly inefficient.

Depends how many times a second the transformation needs to be done, it might 
be ineffient, but in that case you might want to think about caching the 
transformation results.

Cheers,

Jarno - Imminent Starvation: Tentack One

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>