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

position() > 1 not working

Subject: position() > 1 not working
From: "Michele R Combs mrrothen@xxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 5 Mar 2021 18:54:53 -0000
 position() > 1 not working
I want to select all the child <DATA> elements of a <COL> except for the first
one.  I've tried several different things but I must be missing something
stupidly obvious since it isn't working.

Input data:

<ROW>
   <COL><DATA></DATA></COL>
   <COL><DATA>Adult Education Audio and Video Collection</DATA></COL>
   <COL>
      <DATA>SULF</DATA>
      <DATA>Bird</DATA>
      <DATA>Bird</DATA>
      <DATA>Hawkins</DATA>
   <COL>
   <COL>
      <DATA></DATA>
      <DATA>24:F:4</DATA>
      <DATA>36:G:5-7</DATA>
      <DATA>234:A:1-5</DATA>
   <COL>
   <COL>
      <DATA>Box 1-22</DATA>
      <DATA>Adds, 3 boxes</DATA>
      <DATA>Box 23-45</DATA>
      <DATA>Oversize items</DATA>
   <COL>
</ROW>


In my XSL:
<xsl:for-each select="fmp:COL[3]/fmp:DATA[position() > 1]">
  <xsl:variable name="parent-position" select="position()" />
  <xsl:value-of select="../../fmp:COL[3]/fmp:DATA[$parent-position]"/>
  <xsl:value-of select="../../fmp:COL[4]/fmp:DATA[$parent-position]"/>
  <xsl:value-of select="../../fmp:COL[5]/fmp:DATA[$parent-position]"/>
</xsl:for-each>

Expected output:
   Bird 24:F:4 Adds, 3 boxes
   Bird 36:G:5-7 Box 23-45
   Hawkins 234:A:1-5 Oversize items

Actual output:
   SULF Box 1-22
   Bird 24:F:4 Adds, 3 boxes
   Bird 36:G:5-7 Box 23-45
   Hawkins 234:A:1-5 Oversize items


I also tried just getting all the <DATA> elements and then testing the
position:

   <xsl:for-each select="fmp:COL[3]/fmp:DATA">
      <xsl:if test="position() > 1" />

But that gave the same results.  Just to be sure I wasn't crazy, I added an
<xsl:value-of> statement to spit out the value of position() at each point,
and I see exactly what I expect there (1, 2, 3, 4).  What am I missing?

Michele
+++++++++
Michele Combs | Lead Archivist
Special Collections Research Center
Visit our blog! library-blog.syr.edu/scrc/<http://library-blog.syr.edu/scrc/>
Syracuse University Libraries
222 Waverly Ave
Syracuse, New York 13244
t 315.443-2081 | e mrrothen@xxxxxxx<mailto:mrrothen@xxxxxxx> | w scrc.syr.edu
SYRACUSE UNIVERSITY
syr.edu

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.