[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: set:intersection oddity

Subject: RE: set:intersection oddity
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Sun, 29 Jun 2003 13:14:43 +0100
xsl intersect
You are making two mistakes.

Firstly, you are looking at the $data and $rules nodes, not at their
children. $data and $rules are document nodes, and they are distinct
from each other.

Secondly, set:intersect is comparing nodes by identity, not by content.
Two nodes can have the same content but still have distinct identity.

Michael Kay


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of John Sharp
> Sent: 28 June 2003 20:33
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  set:intersection oddity
> 
> 
> 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
> 


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.