[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: XSL to generate required output
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.pickaxe@xxxxxxxxx] Sent: Monday, December 12, 2005 7:35 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: 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() > < 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 :-)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|