This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Capturing/testing results of a boolean expression.
- From: Wendell Piez <wapiez at mulberrytech dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Fri, 02 Aug 2002 17:39:28 -0400
- Subject: Re: [xsl] Capturing/testing results of a boolean expression.
- Reply-to: xsl-list at lists dot mulberrytech dot com
Ed,
If I understand you correctly, what you want is as simple as
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="claim" select="1 > 2"/>
<xsl:template match="/">
<xsl:choose>
<xsl:when test="$claim">True</xsl:when>
<xsl:otherwise>False</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
I tested this by running it against itself in Saxon, and it works as expected.
I hope that helps,
Wendell
At 05:23 PM 8/2/2002, you wrote:
I have state information I need/wish to capture in a
"boolean" variable. I need to use the result of the expression in
multiple places; I do not wish to replicate the expression everywhere it
is needed for maintenance reasons. The value is "static" and I can
establish it at a global context.
I have yet to figure out how to do it. No matter what I try I get a
position evalution of the variable. I can print the variable and see
that I am getting the correct boolean value (true or false). How do
I capture the results of a boolean expression in a variable and how can
I then test the value of that variable?
Please don't ask for details; I don't want specific point-source
alternatives for how to work around the issue I want to how to capture
the results of a boolean expression and then use those results later in
a conditional expression (e.g. xsl:if or xsl:when).
Thanks,
Ed Knoll
--
Edward L. Knoll Phone (work) : (719)484-2717
e-mail (work) : f49660c@cosd.fedex.com
e-mail (business): eknoll@sf-inc.com
e-mail (personal): edward@elknoll.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
======================================================================
Wendell Piez mailto:wapiez@mulberrytech.com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list