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

Re: Incrementing a Global variable

Subject: Re: Incrementing a Global variable
From: Américo Albuquerque <melinor@xxxxxxx>
Date: Wed, 27 Aug 2003 12:40:30 +0100 (WEST)
global var
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()&lt;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()&gt;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&lt;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

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.