[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: shortest way to write this xsl:if statement
At 2012-06-15 12:54 +0100, henry human wrote:
Hello Element names cannot begin with digits, so I'm unclear how you are going to be testing elements such as <6id>. But, assuming you had elements D4/G100/X and D4/G100/Y and D4/G100/Z, you could have in XSLT2 the following: <xsl:if test="D4/G100/(X,Y,Z) = ('A','B','C')"> ... which is equivalent to: D4/G100/X = 'A' or D4/G100/X = 'B' or D4/G100/X = 'C' or D4/G100/Y = 'A' or D4/G100/Y = 'B' or D4/G100/Y = 'C' or D4/G100/Z = 'A' or D4/G100/Z = 'B' or D4/G100/Z = 'C' When using the "=" comparison operator, either operand can be a set. The processor walks through the comparisons in an arbitrary order eventually testing each of the left operand with each of the right operand and stops when it hits a true() result and returns true(). If you get a false() returned, you know the processor has checked every possible combination and every combination has returned false(). I hope this helps. . . . . . . . . . . . Ken -- Public XSLT, XSL-FO, UBL and code list classes in Europe -- Oct 2012 Contact us for world-wide XML consulting and instructor-led training Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal
|
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
|