xsl-list
[Top] [All Lists]

RE: blockQuotes to blockQuote p p

2003-05-02 01:33:30
The following rules should handle this:

<xsl:template match="blockQuotes" priority="20">
<blockQuotes>
  <p><xsl:apply-templates/></p>
  <xsl:apply-template match="following-sibling::*[1][self::blockQuotes]"
        mode="continue"/>
</blockQuotes>
</xsl:template>

<xsl:template
match="blockQuotes[preceding-sibling::*[1][self::blockQuotes]]" 
     priority="30"/>

<xsl:template
match="blockQuotes[preceding-sibling::*[1][self::blockQuotes]]"
priority="30">
  <p><xsl:apply-templates/></p>
  <xsl:apply-template match="following-sibling::*[1][self::blockQuotes]"
        mode="continue"/>
</xsl:template>

In XSLT 2.0 you can use xsl:for-each-group - there is a very similar
example in the spec.

Michael Kay

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Jim_Albright(_at_)wycliffe(_dot_)org
Sent: 01 May 2003 20:00
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] blockQuotes to blockQuote p p


I am having problems with the blockQuotes area of this input file

<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>

I have been trying to get this with a for-each and XPath, but 
am wondering 
it this should be handled by recursion instead. If recursion 
is the answer 
I could use some help getting it started. 


Jim Albright
704 843-0582
Wycliffe Bible Translators


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



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



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