|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: AW: Special processing for the first process of an
Thanks for the ideas, this is what I have got and it appears to work for
the various test cases I have put together.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html" /> <xsl:template match="/">
<xsl:apply-templates select="*|text()" />
</xsl:template> <xsl:template match="p">
<p><xsl:apply-templates select="*|text()" /></p>
</xsl:template> <xsl:template match="document">
<document><xsl:apply-templates select="*|text()" /></document>
</xsl:template><xsl:template match="result"> <xsl:choose> <xsl:when test="preceding::result"> <result class="rest"><xsl:apply-templates select="*|text()" /></result> </xsl:when> <xsl:otherwise> <result class="first"><xsl:apply-templates select="*|text()" /></result> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet> For the test data: <document>
<p>
<p>
<p>
<result>First</result>
</p>
</p>
<p>
<result>Second</result>
</p>
</p>
</document>and a slightly harder document <document>
<p>tom
<p>dick
<p>harry
<result>First</result>
</p>
</p>
</p>
<p>william
<result>Second</result>
<result>Third</result>
</p>
</document>Thanks again
|
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
|

Cart








