|
Subject: Re: [xsl] Need test for preceding-sibling From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Thu, 23 Apr 2009 14:25:51 -0400 |
I have a structure like this:
<a1/> <a2/> <a1/> <a2/> <b/> <c/> <a2/> <a1/> <a2/>
I need to ensure that each <a2> has a preceding <a1>, although there may be intervening tags.
I know that
name(preceding-sibling::*[1]
gives me the name of the first preceding sibling, but how do I construct a test that gives me only the first preceding <a1> or <a2> tag?
<xsl:for-each-group select="*"
group-ending-with="a2">
<xsl:if test="not(current-group()/self::a1)">
Error! No corresponding a1 for the given a2
</xsl:if>
</xsl:for-each-group>-- XSLT/XSL-FO/XQuery hands-on training - Los Angeles, USA 2009-06-08 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Need test for preceding-s, Sree | Thread | RE: [xsl] Need test for preceding-s, Hintz, David L |
| RE: [xsl] Need test for preceding-s, Sree | Date | RE: [xsl] Need test for preceding-s, Hintz, David L |
| Month |