[xsl] Sorry about the wrong subject, here's my question (again)

Subject: [xsl] Sorry about the wrong subject, here's my question (again)
From: "Liao, John Teguh (John)" <jliao@xxxxxxxxxx>
Date: Tue, 29 Oct 2002 18:21:30 -0500

-----Original Message-----
From: Liao, John Teguh (John) 
Sent: Tuesday, October 29, 2002 6:20 PM
To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Subject: RE: [xsl] FO:Leader Pushing Data in seperate table cells

Hi list

I'm trying to compute the column sizes of my tables:

my XML looks like this:

      <DATA_ITEM NAME="TABLE1" DESCRIPTION="SUB CORC=att1,att2,att5"/>
   <TABLE NAME="TABLE1" ... >
      <DATA_ITEM DESIGN_ID="100" NAME="att1" SIZE="8" DB_TYPE="number"/>
      <DATA_ITEM DESIGN_ID="200" NAME="att2" SIZE="4" DB_TYPE="number"/>
      <DATA_ITEM DESIGN_ID="300" NAME="att5" SIZE="32" DB_TYPE="string"/>
      <KEY NAME="INDEX1">
         <ID DESIGN_ID="100"/>
         <ID DESIGN_ID="200"/>

and my xsl looks like this:

<!-- matching ACCESS/NON_TABLE/DATA_ITEM -->
<xsl:template match="DATA_ITEM">
<xsl:if test="@DESCRIPTION and substring-after(@DESCRIPTION,' ')">

T:<xsl:value-of select="@NAME"/>
<xsl:variable name="prikey"
<xsl:variable name="curtbl" select="@NAME"/>
<xsl:for-each select="$prikey/ID">
	<xsl:call-template name="prtoffset">
	    <xsl:with-param name="tblname" select="$curtbl"/>
	<xsl:value-of select="concat (':', position())"/>
<!-- End of DATA_ITEM -->

<!-- context node is TABLE/KEY/ID -->
<xsl:template name="prtoffset">
    <xsl:param name="tblname" select="''"/> 
<xsl:value-of select="$tblname"/>
    <xsl:for-each select="../preceding-sibling::*">
	<xsl:number value="count(node()/@SIZE)"/>           <!--  What is
the right syntax for this? -->
    <xsl:value-of select="."/>  <!-- supposed to be the offset -->

I need the output to look like this:


The output can be read as: T is tablename, att1 is the first key attribute
with an offset of 0 bytes from the beginning
of the table, att2 is the second key attribute with an offset of 8 bytes
from the beginning of the table, att5 is a
regular attribute with an offset of 12 bytes from the beginning of the
attribute. The last number is the position of
the attribute in the document.

I'm having difficulty adding up the SIZEs in the prtoffset template in the
for-each loop. I have not coded the A: for
regular attributes yet. That's the next problem to solve.

Thanks in advance for the help!

P.S. As you can see, I've advanced a little bit from my newbie status :)

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

Current Thread