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

position

Subject: position
From: m.vanrootseler@xxxxxxxxx
Date: Sat, 14 Feb 2004 14:02:04 +0100
xsl position
I'm having trouble using position() in the following situation. The xml
looks like this:

<root>
	<page>
		<line>
			<w>one</w> <w>two<note text="first note"/></w>
<w>three</w>
		</line>
		<line>
			<w>four</w> <w>five</w> <w>six<note text="second
note"/></w>
		</line>
		<line>
			<w>seven<note text="third note"/></w>
<w>eight</w> <w>nine</w>
		</line>
	</page>
	<page>
		<line>
			<w>ten</w> <w>eleven<note text="4th note"/></w>
<w>twelve</w>
		</line>
		<line>
			<w>thirteen</w> <w>fourteen</w> <w>fifteen<note
text="5th note"/></w>
		</line>
		<line>
			<w>sixteen<note text="6th note"/></w>
<w>seventeen</w> <w>eighteen</w>
		</line>
	</page>
</root>

And the xsl file like this:

<xsl:template match="/">
	<html>
		<body>
			<xsl:apply-templates select="root/page"/>
			<br/>
			<xsl:text>Notes:</xsl:text>
			<br/>
			<xsl:for-each select="//note">
				<xsl:value-of select="position()"/>
				<xsl:text> </xsl:text>
				<xsl:value-of select="@text"/>
				<br/>
			</xsl:for-each>
		</body>
	</html>
</xsl:template>

<xsl:template match="page">
	<xsl:apply-templates select="line"/>
	<hr/>
</xsl:template>

<xsl:template match="line">
	<xsl:apply-templates/>
	<br/>
</xsl:template>

<xsl:template match="w">
	<xsl:text> </xsl:text>
	<xsl:apply-templates/>
	<xsl:if test="note">
		<span
style="vertical-align:super;font-size:7pt">*</span>
<!-- --------------------------------------------------------^ position
should go here --> 
	</xsl:if>
</xsl:template>

Instead of the asterisk in the <span>, I'd like to put the value of the
position of the <note> there, just like I did in the root template
(where it works as it should), but I can't get the correct value there. 

Has anyone got any ideas on how to do this? 

Mick





 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.