[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: testing for position of an element and displaying
<xsl:if test child::a> <xsl:apply-templates select="a" mode="test"/> </xsl:if> This seems to be the same problem as the "Axis specifers" list posted earlier, as explained there, teh xsl:if is not doing anything, the above three lines are equivalent to <xsl:apply-templates select="a" mode="test"/> and these have teh effect of processing all a elements, you don't want to do that you want to process all elements in order, both a and b. so just have <xsl:template match="r1"> <xsl:apply-templates /> </xsl:template> a elements appear to be paragraphs <xsl:template match="a"> <p><xsl:apply-templates /></p> </xsl:template> and you want elements to be numbered <xsl:template match="b"> <p><xsl:number/><xsl:apply-templates /></p> </xsl:template> this is again equivalent to the code posted in the earlier thread. > How do I check that if there are <a> elements before > <b> element inside <r1>, then they should be displayed > before the <b> element. And if there are <a> elements > after the <b> element, they should be displayed after > the <b> element? you could check with test="b/preceding-sibling::a" but there is no need to check as the behaviour that you want is the defualt behaviour, the only reason that the a and b elements are being processed out of order is that elsewhere in your code you explictly select all the a elements so they are being processed first. David
|
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
|