Link to home
Start Free TrialLog in
Avatar of deleyd
deleydFlag for United States of America

asked on

XSLT processing-instruction: grab everything after

I have a XML file which looks like this:
<block>
  
    <?foo bar1?>
  
        <section>
          A
        </section>
        <section>
          B
        </section>

    <?foo bar2?>
  
        <section>
          C
        </section>
        <section>
          D
        </section>

</block>

Open in new window

I want the output to be something like this:
A
B
foobar1 stuff

C
D
foobar2 stuff

Open in new window

My XSLT code looks something like this:
<xsl:template match="block">
  <xsl:apply-templates select="* | processing-instruction('foo') "/>
</xsl:template>

<xsl:template match="processing-instruction('foo')">
somehow process everything that follows, up to next "foo" processing-instruction, then output "foobar1 stuff"
</xsl:template>

Open in new window

My problem is how to process everything following the "foo" processing-instruction, up to the next "foo" processing-instruction, and then output "foobar1 stuff".

Is this even possible?
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial