xsl-list
[Top] [All Lists]

RE: Outputing a node whose value appears only once

2005-07-18 21:37:32
Thanks Mike and Ken. That was an oversight on my
part..

Regards,
Mukul

--- Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:

The "|" operator forms the union of two node-sets. I
suspect you meant to
write "or", which combines two booleans. If the two
operands are node-sets,
and if the context expects a boolean, then "|" and
"or" are interchangeable.
In any other situation, they are quite different.

Michael Kay
http://www.saxonica.com/ 

-----Original Message-----
From: Mukul Gandhi [mailto:mukul_gandhi(_at_)yahoo(_dot_)com]

Sent: 19 July 2005 05:00
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Outputing a node whose value
appears only once

I am trying to eliminate duplicates with the
following
logic..

<?xml version="1.0"?> 
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
 
 <xsl:output method="xml" indent="yes" /> 

 <xsl:template match="/root">
   <xsl:for-each select="(a/* | c/*)[not((. =
preceding-sibling::a) | (. = preceding-sibling::c)
|
(. = following-sibling::a) | (. =
following-sibling::a))]">
     <xsl:value-of select="." />
   </xsl:for-each>
 </xsl:template>
 
</xsl:stylesheet>

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? And how I
can
solve it?

Regards,
Mukul

--- Jonathan Marenus <jonathanmarenus(_at_)yahoo(_dot_)com>
wrote:


What I would like to do now is output a value
that
appears only once throughout the XML file. For
example, if I have:

<a>
   <b>value1</b>
   <bb>value2</bb>
   <bbb>value3</bbb>
</a>
<c>
   <b>value1</b>
   <bb>value2</bb>
   <bbb>value4</bbb>
</c>

From the point of view of 'a', I would want to
output
"value3" because 'a' contains it but 'c' does
not. 
This is assuming that the above is the entire
file. 
I
also need to output a sibling of the node which
does
not appear more than once (like the value of a/b
or
a/bbb).  It is also assumed that multiple
instances
of
the same value will have different parents. 
This is
shown in the example above.

Thanks for the help.

Jonathan


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam
protection around 
http://mail.yahoo.com 




--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:

<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam
protection around 
http://mail.yahoo.com 



--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--






--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





                
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--