Merge adjacent sibling nodes with XSLT

前端 未结 4 1725
闹比i
闹比i 2021-01-06 10:28

I have a question that caused me a terrible headache. Please help me. The input is:


 

section 1

4条回答
  •  半阙折子戏
    2021-01-06 10:49

    The issue is that your XML isn't structured enough for a simple XSLT solution.

    The different "section"s are not really setup in a way that is easy to extract them. If you have control over the input XML see if you can change it to something like this:

    
     

    section 1

    some code

    following code

    following code

    section 2

    other code

    following code

    following code

    section 3

    still other code

    following

    following

    This will let you define a xsl-template for "section"s in which you can xsl-foreach over the "code" classes.

提交回复
热议问题