[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Outputing a node whose value appears only once
At 2005-07-18 21:00 -0700, Mukul Gandhi wrote:
I am trying to eliminate duplicates with the following logic.. ... <xsl:for-each select="(a/* | c/*)[not((. = preceding-sibling::a) | (. = preceding-sibling::c) | (. = following-sibling::a) | (. = following-sibling::a))]"> ... Saxon 8.4 is giving error - Error on line 7 of file:/C:/xml/xsleg/xslt/example1.xsl: XPTY0004: Required item type of first operand of '|' is node(); supplied value has item type xs:boolean The error messages are unambiguous and say it all ... you are trying to use the union operator with an operand that is not a node set. And how I can solve it? You are using "|" as "or" and that isn't part of the XPath syntax for boolean operators ... "|" is *only* for the union of node sets. If I've guessed your intent correctly you probably want: <xsl:for-each select="(a/* | c/*)[not((. = preceding-sibling::a) or (. = preceding-sibling::c) or (. = following-sibling::a) or (. = following-sibling::a))]"> This is a *very* common misconception by my XSLT students who are trying to use "or" in my in-class exercises and type "|" because of their programming background. I hope this helps. . . . . . . Ken -- World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc 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
|