[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSLT: question re testing for possibly empty eleme
Ralph,
At 05:17 AM 8/17/2004, you wrote: I guess what the original author really meant was to check if the element is "empty or non-white" - because the data stored in anElement would be a car's license number and it makes no sense to return spaces (which are invisible on the print-out) when there's alternative data stored (which he retrieves in the otherwise-branch). I concur. (Well it's not more accurate, but it is better.) This is not only because of what you say, but also because the construction "string-length(.) > 0" is extremely common in XSLT written by programmers who are heedlessly applying idioms from other languages, not being aware that XSLT doesn't require such gyrations. Another similar case is the use of name tests such as "local-name()='p'" instead of the simpler XPath "self::p". Other languages require grabbing names for testing the types of things; XSLT has its own ways (more elegant and concise IMO). Due to a wrinkle in XPath, one sometimes has to do name testing on attributes (which can't be checked for their type using the self:: axis), but other than that name testing is generally redundant and un-XSL-like. Even though these work, I always correct them when I see them (if only in my head). Cheers, Wendell ====================================================================== 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 ======================================================================
|
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
|