[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: code review

Subject: RE: code review
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Sat, 21 Feb 2004 22:42:05 +0100
code review template document
> -----Original Message-----
> From: Theresa Devine
>
> 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....
>

Hi,

Given your example source document, what exactly do you mean by 'the
occurrence of the schoolname and other info is unpredictable'? That it can
contain quotes, so you need to *first* replace the info, and perform a
subsequent replacement on the result?

*If* you are permitted to, as Jim suggested, change these #...# to simple
empty XML elements, like <data name="..." />.
In your stylesheet, you could then define a template as simple as:

<xsl:template match="data">
  <xsl:value-of select="resstr[name()=current()/@name]" />
</xsl:template>

to handle all possible replacements for you. The resstr being a ref to an
XML structure containing your replacement strings (--IOW a variable wrapper
around your params?)

And (--but maybe that's no real boost in efficiency, not sure)

>
> <xsl:template match="BodyText/Title">
> 	<xsl:if test="../@sycampusid=$sycampusid">

In such scenarios, I usually make either the select or the match pattern for
the template contain the condition, so for example, delete the xsl:if and do
higher up:

<xsl:apply-templates select="BodyText[@sycampusid=$sycampusid]/*">

Saves you a few times of invoking the template for which the condition isn't
true to begin with...

Hope this helps!

Cheers,

Andreas


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.