xsl-list
[Top] [All Lists]

Re: Outputing a node whose value appears only once

2005-07-18 21:00:03
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>
--~--