logo       

Sorry about the wrong subject, here's my question (again): msg#01392

Subject: Sorry about the wrong subject, here's my question (again)

-----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:

<ACCESS>
   <NON_TABLE>
      <DATA_ITEM NAME="TABLE1" DESCRIPTION="SUB CORC=att1,att2,att5"/>
   </NON_TABLE>
   <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"/>
      </KEY_NAME>
   </TABLE>
</ACCESS>

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"
select="../../TABLE[@DB_NAME=current()/@NAME]/KEY"/>
<xsl:variable name="curtbl" select="@NAME"/>
<xsl:for-each select="$prikey/ID">
        <xsl:text>&#10;</xsl:text>
        <xsl:value-of
select="concat('K:',../../DATA_ITEM[@DESIGN_ID=current()/@DESIGN_ID]/@NAME)"
/>
        <xsl:value-of
select="concat(':',../../DATA_ITEM[@DESIGN_ID=current()/@DESIGN_ID]/@DB_TYPE
)"/>
        <xsl:call-template name="prtoffset">
            <xsl:with-param name="tblname" select="$curtbl"/>
        </xsl:call-template>
        <xsl:value-of select="concat (':', position())"/>
</xsl:for-each>
</xsl:if>
</xsl:template>
<!-- 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:for-each>
    <xsl:value-of select="."/>  <!-- supposed to be the offset -->
</xsl:template>

I need the output to look like this:

T:TABLE1
K:att1:number:0:1
K:att2:number:8:2
A:att5:string:12:3

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!

J.L.
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




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
web.pylons.gene...    hurd.l4/2002-10...    kernel.commits....    user-groups.lin...    yellowdog.gener...    java.drools.use...    security.openva...    package-managem...    linux.debian.us...    qnx.openqnx.dev...    genealogy.gramp...    file-systems.if...    voip.wengophone...    tex.context/200...    ietf.smime/2003...    audio.csound.de...    culture.region....    xfree86.devel/2...    mobile.kannel.u...    distributed.con...    education.engli...    org.user-groups...    bug-tracking.gn...    recreation.bicy...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe