[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

Subject: Re: Outputing a node whose value appears only once
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 19 Jul 2005 00:14:02 -0400
first operand of saxon
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

Whereas Xalan-J 2.6.0 gives following error -
Error at xsl:for-each on line 7 of
file:///C:/xml/xsleg/xslt/example1.xsl:
  The value is not a node-set

Can anyone tell where is the problem?

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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.