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

Re: Fetch a sequence of nodes from input file

Subject: Re: Fetch a sequence of nodes from input file
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 23 Sep 2009 21:33:53 -0400
Re:  Fetch a sequence of nodes from input file
At 2009-09-23 18:34 -0400, rowan@xxxxxxxxxxxxxxxxxxxxx wrote:
Thanks very much for these ideas. I'm trying to use Martin's solution but I
don't understand the line:
<xsl:copy-of select="$si | $si/following-sibling::item[. &lt;&lt;
$si/following-sibling::item[level &lt;= $si/level][1]]"/>

What does &lt;&lt; or << mean?

$a << $b is true when the singleton node in the variable "a" is before the singleton node "b" in document order in the same tree.

$a >> $b is true when $a is after $b in document order in the same tree.

$a is $b is true when $a is the same node as $b.

Now I said "in the same tree", but it works it just is implementation dependent when comparing nodes from one tree to another tree. One processor will have it one way and another processor will have it in another order. So you will get true/false when comparing document order between nodes from different trees, but not necessarily the same answer when using two different processors on the same tree.

I hope this helps.

. . . . . . . . . Ken

T:\ftemp>type rowan2.xsl
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

<xsl:output method="text"/>

<xsl:template match="/">
  <xsl:variable name="tree1" as="element(doc)">
  <xsl:variable name="tree2" as="element(doc)">

1/a &lt;&lt; 1/b: <xsl:value-of select="$tree1/a &lt;&lt; $tree1/b"/>
1/a >> 1/b: <xsl:value-of select="$tree1/a >> $tree1/b"/>
1/a is 1/a: <xsl:value-of select="$tree1/a is $tree1/a"/>
1/a is 1/b: <xsl:value-of select="$tree1/a is $tree1/b"/>
1/a &lt;&lt; 2/b: <xsl:value-of select="$tree1/a &lt;&lt; $tree2/b"/>
1/a >> 2/b: <xsl:value-of select="$tree1/a >> $tree2/b"/>

T:\ftemp>xslt2 rowan2.xsl rowan2.xsl

1/a << 1/b: true 1/a >> 1/b: false 1/a is 1/a: true 1/a is 1/b: false 1/a << 2/b: true 1/a >> 2/b: false T:\ftemp>

Upcoming hands-on code list, UBL, XSLT, XQuery and XSL-FO classes.
Interested in other classes?  http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread


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.
First Name
Last Name
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.