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

Re: Getting position of parent

Subject: Re: Getting position of parent
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 20 Feb 2003 15:36:39 +0000
getting div position
Hi Geoff,

> So what I want to do is make $pageNumber = position() -1 for the
> page node while I am in the (grandchild) Field node. How can I
> accomplish this? I'm scratching my head on this one

Try counting the number of preceding sibling Page elements the
ancestor Page element has and adding one to get the position:

  count(ancestor::Page/preceding-sibling::Page) + 1

By the way, you might find your template a bit clearer if you used an
attribute value template to create the style attribute:

<xsl:template match="Field">
  <xsl:variable name="pageNumber"
    select="count(ancestor::Page/preceding-sibling::Page) + 1" />
  <xsl:variable name="top"
    select="@Top * 0.06666 + ($pageNumber * $pageHeight)" />
  <div style="position: absolute;
              top: {$top};
              left: {@Left * 0.06666};
              font-size: {@FontSize}pt;
              font-family: {@FontFamily};">
    <xsl:value-of select="." />
  </div>
</xsl:template>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.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.