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

Any changes if two ancestor nodes instead of one

Subject: Any changes if two ancestor nodes instead of one
From: "Selva, Francis" <Francis.Selva@xxxxxxxxxxxxxxx>
Date: Thu, 27 Apr 2000 09:52:39 -0700
ancestor nodes
It's me again.Finally I found the answer for displaying every 2 elements in
one row.But I get the result only if there is one root element.If I have an
additional node other than the root node,I cant get the results in the right
way.

If my xml is 

<names>
	<name>1</name>
	<name>2</name>
	....
	....
	....
</names>

I get the output like

1 2
3 4
5

using this xsl

<xsl:template match="/">  
<TABLE>  
<xsl:variable name="newrow" select='2'/>  
<xsl:apply-templates select="//name[position() mod $newrow = 1]">  
<xsl:with-param name='newrow' select='$newrow'/>  
</xsl:apply-templates>   
</TABLE>  
</xsl:template>  
<xsl:template match="name">  
<xsl:param name="newrow"/>  
<TR>  
<TD><xsl:value-of select="."/></TD>   
<xsl:apply-templates select="following::name[position() < $newrow]"
mode='somemode'/>   
</TR> 
</xsl:template>  
<xsl:template match="name" mode='somemode'>  
<xsl:param name="newrow"/>  
<TD><xsl:value-of select="."/></TD>  
</xsl:template>  


But if I add one more node between names and name node like 

<names>
	<nameinfo>
		<name>1<name>
	</nameinfo>
	<nameinfo>
		<name>2<name>
	</nameinfo>
	(etc)

</names>

Im getting 
1 2
2 3
3 4
4 5
5

Im guessing that since I have a preceding nameinfo node for every other name
node,it's giving me this error.Am I right?.Any help is appreciated.

Thanx,
Francis

 


 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.