[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: increasing variable?

Subject: RE: increasing variable?
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Sun, 7 Dec 2003 23:07:12 +0100
xsl count variable
> -----Original Message-----
> From: Andreas L. Delmelle
> > -----Original Message-----
> > From: chris poppe
> >
>
> > hope anyone can help me out here, every suggestion is welcome,
> >
>
<snip />

A bit of follow-up here:

(re-wrote some of the expressions to be a little more explanatory --well, at
least that's te intention)
If I'm getting it correctly, and if you made it up to splitting the elements
up to contain an 'offset' and a 'size' element, the XSL below will calculate
the necessary values from the sizes and the start variable.

- halves the sizes of all SUBSTREAM_interiors in a SUBSTR with more than one
SUBSTREAM
- calculates the offsets in the following way :

134
+ sum(previous sizes having a SUBSTR with more than one SUBSTREAM as
ancestor) * 0.5
+ (2 * number of previous SUBSTREAM_interiors having a SUBSTR with more than
one SUBSTREAM as ancestor)
- (2 * number of previous SUBSTR with more than one SUBSTREAM)
+ sum(previous sizes having a SUBSTR with only one SUBSTREAM as ancestor)
+ sum(previous sizes of MV_interior)

I'm not too sure about the second and third addition, but it seemed like you
wanted the total of sizes of the SUBSTR, and 2 added for every SUBSTREAM
except the last in the SUBSTR...

Hope it helps!

Cheers,

Andreas


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" encoding="UTF-8" />

<xsl:variable name="start" select="134" />

<xsl:template match="node()">
  <xsl:copy>
    <xsl:apply-templates select="*" />
  </xsl:copy>
</xsl:template>

<xsl:template match="stuff | MV_end">
  <xsl:copy-of select="." />
</xsl:template>

<xsl:template match="MV_interior | //SUBSTR[count(SUBSTREAM) =
1]//SUBSTREAM_interior">

  <xsl:copy>
    <xsl:value-of select="number($start)
        + ( sum(preceding::size[count(ancestor::SUBSTR/SUBSTREAM) &gt; 1]) *
0.5 )
        + (2 *
count(preceding::SUBSTREAM_interior[count(ancestor::SUBSTR/SUBSTREAM) &gt;
1]))
        - (2 * count(preceding::SUBSTR[count(SUBSTREAM) &gt; 1]) )
        + ( sum(preceding::SUBSTR[count(SUBSTREAM) = 1]//size) )
        + ( sum(preceding::MV_interior/size) )" />
    <xsl:text> </xsl:text>
    <xsl:value-of select="size" />
  </xsl:copy>

</xsl:template>

<xsl:template match="//SUBSTR[count(SUBSTREAM) &gt; 1]//SUBSTREAM_interior">

  <xsl:copy>
    <xsl:value-of select="number($start)
        + ( sum(preceding::size[count(ancestor::SUBSTR/SUBSTREAM) &gt; 1]) *
0.5 )
        + (2 *
count(preceding::SUBSTREAM_interior[count(ancestor::SUBSTR/SUBSTREAM) &gt;
1]))
        - (2 * count(preceding::SUBSTR[count(SUBSTREAM) &gt; 1]) )
        + ( sum(preceding::SUBSTR[count(SUBSTREAM) = 1]//size) )
        + ( sum(preceding::MV_interior/size) )" />
    <xsl:text> </xsl:text>
    <xsl:value-of select="size * 0.5" />
  </xsl:copy>

</xsl:template>

</xsl:stylesheet>


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.