RE: [xsl] code review

Subject: RE: [xsl] code review
From: "Theresa Devine" <tdevine@xxxxxxxxxxxx>
Date: Fri, 20 Feb 2004 15:07:50 -0600
Thanks Jim - all good criticism  -I really appreciate your
consideration. - I will consider it very carefully - here is the xml....

The reason why I used the string replacement is the occurrence of the
schoolname and other info is unpredictable.  The text will also change
(via an admin tool that I will build soon) - this is a beginning of a
content management system. 

<Document>
   <BodyText sycampusid="2">
	  <Title>WELCOME HIGH SCHOOL SENIORS!</Title>
      <Paragraph>#2 No matter what your career aspirations, #schoolname#
can help you get there. We offer exciting programs, taught by working
professionals that provide you with the skills you need for career
advancement.Classrooms and labs are equipped with industry-current
technology so that you may learn new skills applicable for real-world
situations. Personal attention is #schoolname# policy, and course
content is reviewed and updated regularly by our advisory board to
reflect industry trends</Paragraph>
      <Paragraph> #schoolname#  is accredited by #accred#.</Paragraph>
      <Paragraph>After preparing students for seamless integration into
the work environment, our career services staff will assist in
identifying employment options.</Paragraph>
      <Paragraph> Our graduates emerge with a highly marketable degree
and the combined advantages of business sense, technical skills, and
hands-on training necessary for today's competitive job
market.</Paragraph>
      <Link linktarget="programs/index.aspx" linktext="to learn more
about our Programs of Study.">Click Here</Link>
      <Link linktarget="contact/index.aspx" linktext="for more
information about #schoolname#.">Contact Us Today</Link>
   </BodyText>
</Document>


-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Jim Fuller
Sent: Friday, February 20, 2004 2:57 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] code review

> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Theresa Devine
> Sent: 20 February 2004 19:48
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] code review

> I was wondering if ya'll might review my xslt and see if 
> there is a more efficient way of doing this transformation. 
> The part I have questions about is the search and replace.... 

You can also use the generic xslt template at EXSLT for str:replace
found at
http://www.exslt.org/str/functions/replace/index.html or perhaps its
preceding ancestor at Jeni Tennison's page on
http://www.jenitennison.com/xslt/utilities/markup.html

w/o knowing if you have control over your xml data structure ( or seeing
it ) I cant really suggest much...

With your 3rd call-template you might have better joy using a matching
template on text() that does the global replace of ampersands and
special characters using translate() function...though u might also just
use some external process like HTML Tidy to achieve this type of
cleanup.

Your desire to replace text data ( ex. #accred# ) might be better served
by simply using an element as replacement; this is interesting approach
and something that the following article shows though in the context of
character representation

http://www.xml.com/pub/a/2003/01/02/xmlchar.html

Basically u want to have a token in your markup, why not use xml as the
token instead of locking it up in some text format...though maybe u want
to also have some other non xml find and process such tokens...not sure.


gl, Jim Fuller


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




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


Current Thread