[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xsl:variable doesn't work here
Robert,
At 03:02 PM 3/1/2002, you wrote: Instead of What's happening is that you're storing a string ".//article[.//author='C. J. Date']" in your variable, not the node. (Actually it's a result tree fragment with one text node child, but this amounts to the same thing as a string when you test on it.) Given that the variable is assigned and the string is not empty, when evaluated as a Boolean (as it is in an if test), it always tests as true. You can assign the node itself (themselves: as far as the processor knows there could be more than one) to the variable by declaring it like so: <xsl:variable name="condition" select=".//article[.//author='C. J. Date']"/> and that should work for you. But why test for the existence of these nodes at all? If you merely say <xsl:copy-of select=".//article[.//author='C. J. Date']"/> the nodes will be copied if they exist, but if they don't ... they won't. If you have to do more than just copy the nodes or apply templates to them based on your condition (namely whether any exist), then assigning them to a variable to test, and then do your stuff, makes sense. Cheers, Wendell But this does not work. I also tried {$condition} instead of $condition. ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx 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
|
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
|