xsl-list
[Top] [All Lists]

RE: XSL to generate required output

2005-12-13 05:16:38
Hi all,

Thanks for your replies... It worked with xsl below.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
        <xsl:variable name="delimiter" select="'##'"/>
        <xsl:template match="/">
                <WorkSheet>
                        <xsl:apply-templates select="//Table"/>
                </WorkSheet>
        </xsl:template>
        <xsl:template match="Table">
                <xsl:copy>
                        <xsl:apply-templates
select="Row[Cell=$delimiter]" mode="mode1"/>
                </xsl:copy>
        </xsl:template>
        <xsl:template match="Row[Cell=$delimiter]" mode="mode1">
                <Section>
                <xsl:attribute name="name"><xsl:value-of
select="following-sibling::Row/Cell[1]"/></xsl:attribute>
                        <xsl:apply-templates
select="following-sibling::*[1]" mode="mode1"/>
                </Section>
        </xsl:template>
        <xsl:template match="*" mode="mode1">
                <xsl:apply-templates select="."/>
                <xsl:if
test="not(following-sibling::*[1]/self::Row[Cell=$delimiter])">
                        <xsl:apply-templates
select="following-sibling::*[1]" mode="mode1"/>
                </xsl:if>
        </xsl:template>
        <xsl:template match="@* | node()">
                <xsl:copy>
                        <xsl:apply-templates select="@* | node()"/>
                </xsl:copy>
        </xsl:template>
</xsl:stylesheet>

Regards,
Amrit


-----Original Message-----
From: Ragulf Pickaxe [mailto:ragulf(_dot_)pickaxe(_at_)gmail(_dot_)com] 
Sent: Monday, December 12, 2005 7:35 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] XSL to generate required output

Hi Amrit,

Hi Mike,
..
<xsl:variable name="poscurrent" select="position()"/>
..
<xsl:copy-of select="following-sibling::Row[not(Cell='##')][position()

&lt; poscurrent]"/>

I am not Michael, but...

You are here saying that you want the following siblings, that have a
position which is less than the position of the current one. This is an
expression that is always false.

The one I provieded is more in the line of the solutions found in:
http://www.dpawson.co.uk/xsl/sect2/N4486.html (first hit on the google
search that Michael Kay provided).

Regards,
Ragulf Pickaxe :-)

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>