xsl-list
[Top] [All Lists]

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

2007-12-24 06:28:34
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(_at_)colina(_dot_)demon(_dot_)co(_dot_)uk> wrote:
"Mukul" == Mukul Gandhi <gandhi(_dot_)mukul(_at_)gmail(_dot_)com> 
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

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>