xsl-list
[Top] [All Lists]

Getting all the values between empty elements

2004-01-05 13:17:35

Hi All,

I have one final XPath-related question.

If I have a series of sibling elements like <a/>, below:

<p>
        <a/>One or two <b>items</b><a/>or <i>another</i>, I dare
say<a/><c val="#0f0">a third</c>, do you think?<br/>
</p>

how can I get at "everything between one a and the next a"?

Right now, I am formatting by matching on <br/> and looping backwards
(this is greatly simplified).

<xsl:template match="br">

        <xsl:for-each select="preceding-sibling::a">

                <xsl:value-of select="preceding-sibling::text()[1]"/>   
                                                                
        </xsl:for-each>
                        
</xsl:template> 

But, of course, I've run into the problem that what is in-between <a/>s,
could contain elements that would call for further application of
templates - it might not be text-alone.

This is my last question on this particular problem.  Thank you very
much, everyone who has helped me thus far. I hope eventually I will
progress to a point where I can say something that is of help to someone
else.

KP


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>