Subject: Re: [xsl] Grouping immediate follow sibling From: "Joris Gillis" <roac@xxxxxxxxxx> Date: Mon, 31 Jan 2005 16:44:46 +0100 |
Hello,Hi,
I receive XML similar to that shown below:> <ProgAbs>More text</ProgAbs> <ProgAbs>Even more</ProgAbs> </bodyFrag>
Using 'following-sibling::ProgAbs' gives me all the siblings of that name,
as it should. I just need to know how to construct an expression to select
only those <ProgAbs> that follow on immendiately after the <p> element.
In an XPath one-liner, that could be something like 'following-sibling::ProgAbs[count(current()|preceding-sibling::p[1])=1]'
<xsl:template match="bodyFrag"> <xsl:apply-templates select="p"/> </xsl:template>
<xsl:template match="p"> <h1><xsl:value-of select="."/></h1> <p> <xsl:apply-templates select="following-sibling::*[1][self::ProgAbs]"/> </p> </xsl:template>
<xsl:template match="ProgAbs"> <xsl:value-of select="."/> <xsl:apply-templates select="following-sibling::*[1][self::ProgAbs]"/> </xsl:template>
regards, -- Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041) Spread the wiki (http://www.wikipedia.org)
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Grouping immediate follow sib, Paul Clarke | Thread | RE: [xsl] Grouping immediate follow, Michael Kay |
RE: [xsl] from start tag A to end t, Robert Soesemann | Date | RE: [xsl] Help with project needed, Lyublinski, Leonid |
Month |