Re: [xsl] math get maximum and subtract 1

Subject: Re: [xsl] math get maximum and subtract 1
From: "sascha" <sascha@xxxxxxxxxx>
Date: Mon, 29 Jul 2002 14:23:10 +0200
----- Original Message -----
From: "Jeni Tennison" <jeni@xxxxxxxxxxxxxxxx>
Subject: Re: [xsl] math get maximum and subtract 1


> Note that this only works because your DESCRIPTION_ITEMs are sorted by
> column and then by row. If they're sorted in some other way, or aren't
> actually sorted at all, then we need to try another method.


Jeni,

remember that topic? Well, actually that IS what we have right now...
Our client has changed it's export and the description_items aren't sorted
at all.
Unfortunately i do not have an example at the moment. But I am wondering if
there is any way at all to solve this then...
I hope that i will get a real example tomorrow.

Here's the sorted example again:


<DESCRIPTION_TABLE>
   <DESCRIPTION_ITEM col="0" row="0">
    <LABEL>Verantwortlicher</LABEL>
    <VALUE>Text</VALUE>
   </DESCRIPTION_ITEM>
   <DESCRIPTION_ITEM col="0" row="1">
    <LABEL>Prozessziel</LABEL>
    <VALUE>Text</VALUE>
   </DESCRIPTION_ITEM>
   <DESCRIPTION_ITEM col="0" row="2">
    <LABEL>Messgrösse</LABEL>
    <VALUE>Text</VALUE>
   </DESCRIPTION_ITEM>
   <DESCRIPTION_ITEM col="0" row="3">
    <LABEL>Benötigte Informationen</LABEL>
    <VALUE>Text</VALUE>
   </DESCRIPTION_ITEM>
   <DESCRIPTION_ITEM col="0" row="4">
    <LABEL>Erzeugte Ergebnisse</LABEL>
    <VALUE>Text</VALUE>
   </DESCRIPTION_ITEM>
   <DESCRIPTION_ITEM col="1" row="0">
    <LABEL>Externe Vorschriften</LABEL>
    <VALUE>Text</VALUE>
   </DESCRIPTION_ITEM>
   <DESCRIPTION_ITEM col="1" row="1">
    <LABEL>Hinweise</LABEL>
    <VALUE>Text</VALUE>
   </DESCRIPTION_ITEM>
   <DESCRIPTION_ITEM col="1" row="2">
    <LABEL>Potenzial</LABEL>
    <VALUE>Text</VALUE>
   </DESCRIPTION_ITEM>
   <DESCRIPTION_ITEM col="1" row="3">
    <LABEL>Mitgeltende Unterlagen</LABEL>
    <VALUE>Text</VALUE>
   </DESCRIPTION_ITEM>
   <DESCRIPTION_ITEM col="1" row="4">
    <LABEL>Offene Fragen</LABEL>
    <VALUE>Text</VALUE>
   </DESCRIPTION_ITEM>
  </DESCRIPTION_TABLE>

and the working template:

<xsl:template match="DESCRIPTION_TABLE">

<xsl:variable name="nrows" select="DESCRIPTION_ITEM[last()]/@row + 1" />
<xsl:variable name="ncols" select="DESCRIPTION_ITEM[last()]/@col + 1" />


  <fo:table table-layout="fixed" width="100%">

    <xsl:for-each select="DESCRIPTION_ITEM[@row = 0]">
    <fo:table-column column-width="proportional-column-width(1)" />
  </xsl:for-each>


    <fo:table-body font-size="8pt">


   <xsl:for-each select="DESCRIPTION_ITEM[@col = 0]">
    <fo:table-row>
      <xsl:for-each select="../DESCRIPTION_ITEM [(position() - 1) mod $nrows
= current()/@row]">

        <fo:table-cell>
         <fo:block>
  <xsl:call-template name="desc_items"><xsl:with-param name="item"
select="."/></xsl:call-template>
          </fo:block>
        </fo:table-cell>
      </xsl:for-each>
    </fo:table-row>
  </xsl:for-each>

    </fo:table-body>
  </fo:table>
</xsl:template>


any idea, already?

sascha




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread