Re: [xsl] 'except' operator on atomic integer values

Subject: Re: [xsl] 'except' operator on atomic integer values
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Mon, 24 Dec 2007 18:58:01 +0530
Hi Colin,
   Thanks for the idea, but it doesn't seem to work for my example. I
tried this example:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                        version="2.0">

 <xsl:output method="text" />

 <xsl:template match="/">
  <xsl:variable name="seq1">
    <one>1</one>
    <two>2</two>
    <three>3</three>
  </xsl:variable>
  <xsl:variable name="seq2">
    <one>1</one>
    <two>2</two>
  </xsl:variable>

  <xsl:value-of select="($seq1/one, $seq1/two, $seq1/three) except
($seq2/one, $seq2/two)" />

 </xsl:template>

</xsl:stylesheet>

This produces output:
1, 2, 3

But I am expecting:
3

The problem I think is: $seq1/one and  $seq2/one are different nodes;
as they belong to different trees.

Do you have any ideas, how to resolve this issue?

Ken's technique (which I initially proposed) works for me. But I want
to explore the possibility of using 'except' operator for this
problem.


On Dec 24, 2007 4:41 PM, Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx> wrote:
> >>>>> "Mukul" == Mukul Gandhi <gandhi.mukul@xxxxxxxxx> writes:
>
>    Mukul> Is it possible to cast atomic values like integers above to
>    Mukul> a suitable node, so that except operator works on such data
>    Mukul> ?
>
> You can use a temporary tree.
>
> Something like:
>
> <xsl:variable name="integers">
>  <one>1</one>
>  <two>2</two>
>  <three>3</three>
> </xsl:variable>
>
> Now your set of 1,2,3 can be coded as:
>
> ($integers/one, $integers/two, $integers/three)
> --
> Colin Adams
> Preston Lancashire


-- 
Regards,
Mukul Gandhi

Current Thread