Subject: RE: Outputing a node whose value appears only once
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 19 Jul 2005 05:08:30 +0100
|
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@xxxxxxxxx]
> Sent: 19 July 2005 05:00
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: 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@xxxxxxxxx>
> 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
> >
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
|