|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Using the value of an element in a test condition
Hi Folks,
I have an XML document that contains conditions which must be tested in
another XML document. For example, here's document 1:
<root>
<condition>not(A and B)</condition>
<condition>A = 'hello'</condition>
</root>
Here's document 2:
<root>
<A>hello</hello>
</root>
I need to test document 2 against each condition (which is data) in
document 1.
Suppose that I create a variable, cond, whose value is the first
condition listed above:
cond
|--------------|
| |
| not(A and B) |
| |
|--------------|
Suppose that my current context is document 2. I cannot simply do this:
<xsl:if test="$cond">
Document 2 meets this condition: <xsl:value-of select="$cond"/>
</xsl:if>
The xsl processor will simply test to see if the cond variable has a
value. That's not what I want. I want the xsl processor to evaluate
the value of cond. So, I want something like this:
<xsl:if test="evaluate($cond)">
Document 2 meets this condition: <xsl:value-of select="$cond"/>
</xsl:if>
Of course I made up this evaluate() function. Is there something
equivalent in xslt/xpath? In other words, how do I solve this problem?
/Roger
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








