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 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: Followup question about transfo, Kay Michael | Thread | Advice for "conditional" DTD parame, Bruce Rosenstock |
Followup question about transformin, Jonathan Schroeder | Date | RE: including the HTML <BR> in XSL , Khun Yee Fung |
Month |