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

Re: Create Table

Subject: Re: Create Table
From: "Eric J. Bowman" <eric@xxxxxxxxxxxxxxxx>
Date: Sat, 27 Mar 2010 01:22:26 -0600
Re:  Create Table
> So this answer extends the example already given, by adding the number
> () function.
>

Heh, don't listen to me, I'm still learning myself... number() isn't 
needed here, as this works just fine:

<th><xsl:value-of select='./@lineId+1'/></th>

What I've just learned, is that I need to take a closer look at how
XSLT processors handle typing, my answer assumed number() was needed in
order to perform addition like you were trying, and was thus totally 
wrong.

Anyway, I played around with it a bit more, adding this to my <tr>
template:

<xsl:param name='x' select='./@lineId'/>

And changing the <th> two different ways, as follows:

<th><xsl:value-of select='following-sibling::data[@lineId=$x]/@lineId'/></th>
<th><xsl:value-of select='following-sibling::data[@lineId=$x+1]/@lineId'/></th>

The first line results in <th/>, the second line works as expected.
The first line can be rewritten as select='//data[@lineId=$x]/@lineId' 
and it will work as expected.  So I suspect your problem is one of not
minding your context node, i.e. you started with this:

<xsl:param name='x' select='./@lineId'/>

Then, you have <xsl:value-of select='data[@lineId=$x]'/>, which can't 
work  because you haven't selected an axis...  So it's hard to know how 
to specifically help you here -- the 'data[@lineId=$x]' is correct, but 
only if it's preceded by a proper axis, and followed by '/@lineId' since 
you're after attribute content, instead of element content.

-Eric

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.