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

Re: constructing the Node Sets

Subject: Re: constructing the Node Sets
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Mon, 27 Jan 2003 21:20:34 -0800 (PST)
xpath kaysian
"Joerg Heinicke" <joerg.heinicke@xxxxxx> wrote in message
news:3E35E0F1.1030305@xxxxxxxxx
> XML:
> 
> <root>
>      <a>
>          <node>1</node>
>          <node>2</node>
>          <node>3</node>
>          <node>4</node>
>          <node>5</node>
>      </a>
>      <b>
>          <node>3</node>
>          <node>4</node>
>          <node>5</node>
>          <node>6</node>
>          <node>7</node>
>          <node>8</node>
>      </b>
> </root>
> 
> XSL:
> 
> <xsl:template match="/root">
>    <root>
>      <xsl:variable name="a" select="a/node"/>
>      <xsl:variable name="b" select="b/node"/>
>      <c>
>        <xsl:copy-of select="$a[. = $b]"/>
>      </c>
>    </root>
> </xsl:template>



The question was for an XPath expression that returns the intersection
of two node-sets. The above obviously will not work like that. E.G. for
nodes that do not have text children, or generally for non-element
nodes, for multiple nodes having the same string string value, for
nodes having more than one text child, etc.

Node-set intersection of a node-set $a and node-set $b is given by the
following XPath expression (Kaysian method):

$a[count(. | $b ) = 1]




=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

 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.