RE: [xsl] A variable in the test attribute of <xsl:if> ?

Subject: RE: [xsl] A variable in the test attribute of <xsl:if> ?
From: "John Horner" <Horner.John@xxxxxxxxxx>
Date: Fri, 26 Oct 2007 11:57:56 +1000
The reason I thought about doing this:

The XSL CMS I work with involves a lot of <xsl:copy-of> from one file to
another based on a wide variety of conditions, say for instance a simple

   "(X = 'foo' and Y = 'bar')"

which is easily able to be parameterised -- you have a
"x-and-y-must-match-params.xsl" and you pass it a value for X, a value
for Y.

but for complex, specialised requirements like

    "((X='foo' and Y='bar') or (Z='baz' and (A!='bof' or B='bop'))) or
(starts-with(C,'quux'))"

there's no sane way to generalise it and feed it params. You end up with
a large number of xsl files, each performing one specific job.

If I could create a "must-match-this-if-clause.xsl" and feed it the
above string, it would be more efficient.

Any other ways to approach this problem?


-----Original Message-----
From: Florent Georges [mailto:lists@xxxxxxxxxxxx]
Sent: Thursday, 25 October 2007 9:09 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] A variable in the test attribute of <xsl:if> ?

Michael Kay wrote:

  Hi

> As specified in EXSLT, dyn:evaluate() can return a value of
> any type (including of course a boolean). But there may be
> restrictions in the MSXML implementation, I don't know.

  Maybe the OP can find something else and avoid the need for
dyn:evaluate().  Almost everytime I saw the "need" for such a feature,
there were other ways to do the job, with more restricted
possibilities.  Such as testing an element name and then testing its
value against a sequence of strings, or more elaborated things...

  But for that, the OP should tell us exactly what he wants and why.

  Regards,

--drkm
























________________________________________________________________________
_____
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo!
Mail

Current Thread