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

Re2: how to get new position() of a node in a sorted r

Subject: Re2: how to get new position() of a node in a sorted result tree ANDdocument function and counting
From: David_Marston@xxxxxxxxx
Date: Wed, 1 Aug 2001 18:41:23 -0400
msxml get position in file
Rolling together Michael Kay's and Wendell Piez's answers on their
respective threads, plus using a technique favored here at Lotus, we
have a dual solution that uses no extension functions. This can be
accomplished if one of the XML documents can contain a list of all the
XML files to be read in:

<?xml version="1.0" ?>
<files>
  <a>idkey49a.xml</a>
  <a>idkey49b.xml</a>
  <a>idkey49c.xml</a>
  <a>idkey49d.xml</a>
</files>

As long as <a> nodes are not used for any other purpose, then
document(a)//b will be a single node-set, not an RTF, containing all
the <b> nodes from all four files. Then, you can set up iteration over
the whole set, and sort it:

<xsl:apply-templates select="document(a)//b">
   <xsl:sort select="."/>
</xsl:apply-templates>

And in the next template, the position() function will return what you
wanted, a contiguous numbering of all the <b> elements from all files:

<xsl:template match="b">
  <xsl:value-of select="position()"/><xsl:text>. </xsl:text>
  <xsl:value-of select="."/><xsl:text>&#10;</xsl:text>
</xsl:template>

Embellish the above as necessary.
.................David Marston


 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.