[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Incrementing a Global variable
Subject: Re: [xsl] Incrementing a Global variable From: Américo Albuquerque <melinor@xxxxxxx> Date: Wed, 27 Aug 2003 12:40:30 +0100 (WEST) |
Hi Citando Rajendra S Rawat <rajsrawat@xxxxxxxxx>: } Hi! Mukul } } Perhaps nobody understood my problem } } XSL/XPath have failed to do a trivial thing!! } } Here are some more detail... } } This is an database(Oracle9i) } generated complex xml, which is validated by some } standard schemas.Which I am transforming to XSL:FO } using XSLT to get a PDF output. } } It would be not possible to post 4000 lines complete } xslt code. I've formulated sample files to illustrate } the problem(now I've made it a pure XSL problem and } not a FO problem, but FO Solution is also welcome ): } ************************************************ } (...) } } PDF/HTML Output:( I Require) } -------------------------- } |1 |SAM |English | } |--|-----------|---------| } |2 |RAJ |English | } |--|-----------|---------| } |3 |RON |English | } |--|-----------|---------| } |4 | | | } |--|-----------|---------| } |5 |JON |German | } |--|-----------|---------| } |6 |DON |German | } |--|-----------|---------| } |7 | | | } |--|-----------|---------| } |8 |MON |Hebrew | } |--|-----------|---------| } |9 |GON |Hebrew | } |--|-----------|---------| } |10| Total = 7 | | } |--|-----------|---------| } |11| | | } |--|-----------|---------| } |12| | | } |--|-----------|---------| } |13| | | } |--|-----------|---------| } |14| | | } |--|-----------|---------| } |15| | | } -------------------------- } **************************************** } try this stylesheet, you'll have to define the fn prefix to the namespace "urn:schemas-microsoft-com:xslt" if you're using msxml or to "http://exslt.org/common" if your processor suports xslt. <xsl:key match="Student" name="studant" use="TOption"/> <xsl:template match="Students"> <xsl:variable name="std"> <xsl:apply-templates mode="var" select="Student[generate-id()=generate-id(key('studant',TOption))]"/> <item name="Total = {count(Student)}"/> </xsl:variable> <table> <xsl:apply-templates select="fn:node-set($std)/item[position()<16]"/> <xsl:call-template name="fill-table"> <xsl:with-param name="cnt" select="count(fn:node-set($std)/item) + 1"/> </xsl:call-template> </table> </xsl:template> <xsl:template match="item"> <tr> <td> <xsl:value-of select="position()"/> </td> <td> <xsl:value-of select="@name"/> </td> <td> <xsl:value-of select="@option"/> </td> </tr> </xsl:template> <xsl:template match="Student" mode="var"> <xsl:if test="position()>1"> <item/> </xsl:if> <xsl:apply-templates mode="var-list" select="key('studant',TOption)"/> </xsl:template> <xsl:template match="Student" mode="var-list"> <item name="{Name}" option="{TOption}"/> </xsl:template> <xsl:template name="fill-table"> <xsl:param name="cnt" select="16"/> <xsl:choose> <xsl:when test="$cnt<16"> <tr> <td><xsl:value-of select="$cnt"/></td> </tr> <xsl:call-template name="fill-table"> <xsl:with-param name="cnt" select="$cnt + 1"/> </xsl:call-template> </xsl:when> </xsl:choose> </xsl:template> Regards, Americo Albuquerque ___________________________________________________________________ O SAPO já está livre de vírus com a Panda Software, fique você também! Clique em: http://antivirus.sapo.pt XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Incrementing a Global var, Rajendra S Rawat | Thread | [xsl] Info on Transforming to PDF, allan . mccluskey |
Re: [xsl] recursion with xsl:apply-, David Carlisle | Date | RE: [xsl] URL rewriting with sessio, Shane Porter |
Month |