xsl-list
[Top] [All Lists]

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

2007-10-25 01:18:19

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.

Michael Kay
http://www.saxonica.com/
 

-----Original Message-----
From: John Horner [mailto:Horner(_dot_)John(_at_)abc(_dot_)net(_dot_)au] 
Sent: 25 October 2007 04:27
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] A variable in the test attribute of <xsl:if> ?

This may well be impossible, but I was wondering if (using 
MSXSL) I could somehow use a variable in the test attribute 
of <xsl:if> ?

Instead of <xsl:if test="foo = 'bar'">, I would like to have 
"foo = 'bar'" in a variable and do this:

    <xsl:if test="$test">

Every time I search, I find mentions of the jscript dyn:evaluate
function:

 function evaluate(context, expression)
      {
         return context.nextNode().selectNodes(expression);
      }


 but that only seems to work in returning a value -- that is, 
I can do:

   <xsl:value-of select="dyn:evaluate(., <SOME EXPRESSION HERE> )"/>

but I can't do 

    <xsl:if test="dyn:evaluate(., <SOME EXPRESSION HERE> )">

to return a boolean for whether the node matches. 

Is there another function I could use?

==============================================================
================
The information contained in this email and any attachment is 
confidential and
may contain legally privileged or copyright material.   It is 
intended only for
the use of the addressee(s).  If you are not the intended 
recipient of this email, you are not permitted to 
disseminate, distribute or copy this email or any 
attachments.  If you have received this message in error, 
please notify the sender immediately and delete this email 
from your system.  The ABC does not
represent or warrant that this transmission is secure or 
virus free.   Before
opening any attachment you should check for viruses.  The 
ABC's liability is limited to resupplying any email and 
attachments 
==============================================================
================

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--