OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: calculating with xslt


Hi!

I have not such a big idea of xslt but im learning it. I'm working with 
Docbook v5, mainly print documents.

My aim: getting a table with 2 columns and several rows in a xml file.
One column for the occupation and one column for the cost.
In the last row I want to get the total amount of all occupations.

My try:

<!-- The version has nothing to do with the version of the section. I 
used it for the cost. 300 means 300 ¤-->
<article>
<section>
     <title id="001" version="300">Optionale Module</title>

     <para>.....</para>
     </section>
     <section>
       <title id="002" version="300">Newsletter</title>

       <para>Dauer: 3 Tag(e)</para>

       <para>..../para>
     </section>
</article>

and so on...with the following stylesheet
========================================================

     <xsl:template match="article">
     <table>
     <title>An example of complex table</title>

     <tgroup cols="2">
       <tbody>
        <row>
         <entry>
             <xsl:for-each select="section/title">
                 <para>
                     <xsl:value-of select="."/>
                 </para>
             </xsl:for-each>
         </entry>
       <entry>
         <para>
        <xsl:variable name="tmpTotal">
             <xsl:for-each select="section/title">
                       <xsl:value-of select="@version"/>
                 </xsl:for-each>
              </xsl:variable>
             <xsl:variable name="myTotal" 
select="xalan:nodeset($tmpTotal)"/>
             <xsl:value-of select="sum($myTotal/entry/para)" />
         </para>
         </entry>
     </row>
    </tbody>
   </tgroup>
  </table>
  </xsl:template>
</xsl:stylesheet>

-- 
Gruß Lwam Berhane



punkt.de GmbH               TYPO3-Internet-Dienstleistungen-Beratung
Kaiserallee 13a             Tel.: 0721 9109-0  Fax: -100
76133 Karlsruhe             info@punkt.de    http://punkt.de/
AG Mannheim 108285          Gf: Jürgen Egeling


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]