Subject: Re: [xsl] XPath selecting chain of following siblings of the same name From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Sat, 10 Mar 2007 19:45:49 +0000 |
I wonder, why this XSLT 1.0 solution doesn't work:
<xsl:apply-templates select="following-sibling::*[1][self::a]" />
<!--identity transform for all nodes other than 'a'--> <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*" /> </xsl:copy> </xsl:template>
<!--the first a--> <xsl:template match="a[not(preceding-sibling::*[1][self::a])]"> <a-block> <xsl:apply-templates select="." mode="nested"/> </a-block> </xsl:template>
<!--other a's when nested--> <xsl:template match="a" mode="nested"> <xsl:copy-of select="."/> <xsl:apply-templates select="following-sibling::*[1][self::a]" mode="nested"/> </xsl:template>
<!--other a's when not nested can be ignored--> <xsl:template match="a"/>
-- World-wide corporate, govt. & user group XML, XSL and UBL training RSS feeds: publicly-available developer resources and training G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Aug'05 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XPath selecting chain of , Mukul Gandhi | Thread | Re: [xsl] XPath selecting chain of , Mukul Gandhi |
Re: [xsl] fo:marker weirdness?, G. Ken Holman | Date | Re: [xsl] Using the collection(), Colin Adams |
Month |