[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] increasing variable?
Subject: RE: [xsl] increasing variable? From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx> Date: Sun, 7 Dec 2003 23:07:12 +0100 |
> -----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) > 1]) * 0.5 ) + (2 * count(preceding::SUBSTREAM_interior[count(ancestor::SUBSTR/SUBSTREAM) > 1])) - (2 * count(preceding::SUBSTR[count(SUBSTREAM) > 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) > 1]//SUBSTREAM_interior"> <xsl:copy> <xsl:value-of select="number($start) + ( sum(preceding::size[count(ancestor::SUBSTR/SUBSTREAM) > 1]) * 0.5 ) + (2 * count(preceding::SUBSTREAM_interior[count(ancestor::SUBSTR/SUBSTREAM) > 1])) - (2 * count(preceding::SUBSTR[count(SUBSTREAM) > 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] increasing variable?, Andreas L. Delmelle | Thread | [xsl] increasing variable?, chris poppe |
RE: [xsl] Saxon and XT both exhibit, Michael Kay | Date | Re: [xsl] Saxon and XT both exhibit, David Tolpin |
Month |
Keywords