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

Re: Re: Using XSLT to add markup to a document

Subject: Re: Re: Using XSLT to add markup to a document
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Mon, 7 Jul 2003 21:56:07 +0200
xslt for each string
> > While this is a nice solution, it will not produce good
> > results in the case when one of  the search strings is the
> > start of another of the search strings.
>
> I don't think this is true - it just requires intelligent ordering of the
> xsl:when statements.  You'd want the check for the longer string to appear
> first.  Unless I don't understand how xsl:choose works.

I agree. But I was discussing the solution as it was originally presented.

Ordering the xsl:when clauses by the decreasing length of the search strings
will provide a solution when the longest string should be searched for
first.

However, this will make it impossible to support the general case when the
caller is allowed to specify the order in which to search for each string.


>
> > Also, all possible search strings are hard-coded in the code
> > within an xsl:choose.
>
> Yes.  Not very general, but adequate for everything that I need to do.
>
>
> > This is not going to help in the case when we need to call
> > this template, passing it a parameter containing an unknown
> > number of search strings.
>
> Yes.  I guess you could have a different stylesheet that generated the
code
> of the choose for you.

So, this would be a transformation, the result of which is another
transformation.

>
> >
> > Even if you try to use the xsl:choose approach with a
> > moderate number of predefined strings (e.g. 5 - 10), the code
> > will increase quadratically to the number of search strings.
>
> I don't understand this.  For each string you are interested in, there is
> one xsl:when statement.  Why is that quadratic?

I was wrong here -- just 2 * N xsl:call-template instructions. In this
particular case N was 2, 2 * N was 4
and it just happens that 2 * N = N^2

2 * N is much shorter.

And, of course, if the code will be generated (not manually produced), 2 * N
is not such a problem.


The two-stage solution requires the produced stylesheet to be further loaded
and executed and this may affect the convenience and efficiency of this
approach.


As I said earlier, this is a nice solution and it would be easy to use in
the simple cases.



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL




 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.