|
Subject: Re: [xsl] Sorry about the wrong subject, here's my question (again) From: john liao <jliao2k@xxxxxxxxx> Date: Wed, 30 Oct 2002 19:07:13 -0800 (PST) |
would anyone mind answering the question in my
prtoffset template please?
thanks
--- "Liao, John Teguh (John)" <jliao@xxxxxxxxxx>
wrote:
>
>
> -----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>
</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
>
=====
__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Sorry about the wrong subject, Liao, John Teguh (Jo | Thread | Re: [xsl] Sorry about the wrong sub, Mulberry Technologie |
| Re: [xsl] String Manipulation - Dis, Greg Faron | Date | RE: [xsl] XML to HTML... dynamic ta, Alan K. Gay |
| Month |