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

Re: again position()?

Subject: Re: again position()?
From: "Christopher R. Maden" <crism@xxxxxxxxx>
Date: Tue, 19 Jun 2001 03:45:59 -0700
xslt ancestor position
At 03:30 19-06-2001, Daniel Bauke wrote:
at first: thanks for all earlier answers -- i'll try to use them
later.. i'm doing my xsl pages after hours, so i don't have much
time for it the more it's not so intuitive language :-)

I strongly recommend a reference like Mike Kay's _XSLT Programmer's Reference_; that will save you a lot of silly questions.

i'd like to ask for a solution for such test:
   if ((current("part") == 1) && (current("chapter") == 1))
in xslt.

by current() i mean a function which returns current
position of a tag in xpath tree.

For example, current() is a well-defined XSLT function that does something entirely different, and the logical syntax is nothing like C's.


<xsl:if test="count(ancestor::part|ancestor::part/../part[1]) = 1 and
              count(ancestor::chapter|ancestor::chapter/../chapter[1]) =
  <xsl:attribute name="intro">true</xsl:attribute>

The count() expression tests if the ancestor in question is the same as the first such at that level. There may be a more efficient way, but it's too late (early?) for me right now.

your solution for espresso-pizza-and-Zappa-fueled 24-hour XSLT support
Christopher R. Maden, XML Consultant
DTDs/schemas - conversion - ebooks - publishing - Web - B2B - training
<URL: http://crism.maden.org/consulting/ >
PGP Fingerprint: BBA6 4085 DED0 E176 D6D4  5DFC AC52 F825 AFEC 58DA

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

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.