[xsl] set:intersection oddity

Subject: [xsl] set:intersection oddity
From: John Sharp <jsharp@xxxxxx>
Date: Sat, 28 Jun 2003 14:33:12 -0500
Hello, I was attempting to use the set:intersection function
from http://exslt.org/sets.  The examples showing the intersection
of cities with letters 'i' and 'e' work as given. However the
following does not work - INTERSECT1 is always empty.

<xsl:stylesheet 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:saxon="http://saxon.sf.net/"; 
  xmlns:set="http://exslt.org/sets";
  extension-element-prefixes="set saxon"
version="1.1">

<xsl:template match="/">

  <xsl:variable name="data">
    <Type>PMT</Type>
    <Type>FUNC</Type>
  </xsl:variable>

  <xsl:variable name="rules">
    <Type>PMT</Type>
    <Type>DC_PARA</Type>
    <Type>FUNC</Type>
  </xsl:variable>


  <INTERSECT1>
    <xsl:copy-of select="set:intersection($data,$rules)"/>
  </INTERSECT1>

  <INTERSECT2>
    <xsl:copy-of select="set:intersection($data,$data)"/>
  </INTERSECT2>

  <INTERSECT3>
    <xsl:copy-of select="$data[count(. | $rules) != count( $rules)]"/>
  </INTERSECT3>

</xsl:template>


Here's the output:-

<?xml version="1.0" encoding="UTF-8"?>
<INTERSECT1/>
<INTERSECT2>
   <Type>PMT</Type>
   <Type>FUNC</Type>
</INTERSECT2>
<INTERSECT3>
   <Type>PMT</Type>
   <Type>FUNC</Type>
</INTERSECT3>Execution time: 336 milliseconds


If I run the exslt web page example, it runs fine.

Kind regards,John.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread