Subject: [xsl] blockQuotes to blockQuote p p From: Jim_Albright@xxxxxxxxxxxx Date: Thu, 1 May 2003 15:47:28 -0400 |
<section> <head></head> <parallelPassage></parallelPassage> <paragraph></paragraph> <blockQuotes></blockQuotes> <blockQuotes></blockQuotes> <blockQuotes></blockQuotes> <paragraph></paragraph> <paragraph></paragraph> <blockQuotes></blockQuotes> <blockQuotes></blockQuotes> <blockQuotes></blockQuotes> <paragraph></paragraph> </section> output should be: <div> <head></head> <parallelPassage></parallelPassage> <p></p> <blockQuote> <p></p> <p></p> <p></p> </blockQuote> <p></p> <p></p> <blockQuote> <p></p> <p></p> <p></p> </blockQuote> <p></p> </div> Here is the recursive code that I have so far that doesn't work. <xsl:template match="blockQuotes"> <xsl:choose> <!-- if first blockQuotes then put create element blockQuote and include p--> <xsl:when test="not(preceding-sibling::*[1][self::blockQuotes])"> <xsl:element name="blockQuote"> <!-- check to see if the next node is a blockQuote if so call blockQuotes with next node as content--> <xsl:call-template name="nextBlockQuote"> <xsl:with-param name="nodeBlockQuotes" select="following-sibling::*[1]/blockQuotes"/> </xsl:call-template> </xsl:element> </xsl:when> <!-- otherwise call this p and test for a following blockQuotes--> <xsl:otherwise> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="nextBlockQuote"> <xsl:param name="nodeBlockQuotes"/> <xsl:call-template name="lineGroupOrP"/> <xsl:for-each select="$nodeBlockQuotes"> <xsl:if test="following-sibling::*[1][self::blockQuotes]"> <xsl:call-template name="nextBlockQuote"> <xsl:with-param name="nodeBlockQuotes" select="following-sibling::*[1][self::blockQuotes]"/> </xsl:call-template> </xsl:if> </xsl:for-each> </xsl:template> <xsl:template name="lineGroupOrP"> <xsl:choose> <xsl:when test="child::paragraph-continuation"> <xsl:apply-templates select="child::paragraph-continuation"/> </xsl:when> <xsl:when test="child::lineGroup"> <xsl:apply-templates select="child::lineGroup"/> </xsl:when> <xsl:otherwise> <xsl:element name="p"> <xsl:apply-templates/> </xsl:element> </xsl:otherwise> </xsl:choose> </xsl:template> Jim Albright 704 843-0582 Wycliffe Bible Translators XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] blockQuotes to blockQuote, Lars Huttar | Thread | Re: [xsl] blockQuotes to blockQuote, Wendell Piez |
Re: [xsl] Comparing Variables, me | Date | Re: [xsl] blockQuotes to blockQuote, Wendell Piez |
Month |