Subject: Re: [xsl] Getting position of parent From: Geoff Hankerson <ghank@xxxxxxxxxxx> Date: Thu, 20 Feb 2003 11:48:18 -0600 |
<xsl:variable name="pageNumber" select="../../@Pagenumber" />
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Getting position of paren, Jeni Tennison | Thread | RE: [xsl] Selecting from a node-set, Martinez, Brian |
[xsl] double pass in XSLT2, Tobias Reif | Date | [xsl] Reading the DocType in XSL, Gary Lawrence Murphy |
Month |