Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. limited iteration

limited iteration

Scheduled Pinned Locked Moved XML / XSL
xmlhelpdatabasetutorial
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TClarke
    wrote on last edited by
    #1

    Hi all, I'm fairly new to xsl so please bare with me if this is a trivial issue. I'm getting my XML from a database so it's just a string of row nodes with nodes representing the values of the row within. Mostly it is one row per page. However, sometimes it is more, maximum 4 rows per page. Each row node has a child node rowsequence which states what number row on the page the row should be. So far I have been able to get to the beginning of each sequence of row nodes as follows: However, I am not sure what to do next. How, to iterate over the following nodes that are supposed to be on the same page. all I can see is the logic should be: starting from the first node in the sequence keep iterating forward until you find a row node whose rowsequence node has a value of 1. If anyone show me how to write this into XSL it would greatly appreciated. Thank you for any help PS I'm using XSL 2.0 (Saxon 8) Cheers Tom Philosophy: The art of never getting beyond the concept of life. Religion: Morality taking credit for the work of luck.

    G 1 Reply Last reply
    0
    • T TClarke

      Hi all, I'm fairly new to xsl so please bare with me if this is a trivial issue. I'm getting my XML from a database so it's just a string of row nodes with nodes representing the values of the row within. Mostly it is one row per page. However, sometimes it is more, maximum 4 rows per page. Each row node has a child node rowsequence which states what number row on the page the row should be. So far I have been able to get to the beginning of each sequence of row nodes as follows: However, I am not sure what to do next. How, to iterate over the following nodes that are supposed to be on the same page. all I can see is the logic should be: starting from the first node in the sequence keep iterating forward until you find a row node whose rowsequence node has a value of 1. If anyone show me how to write this into XSL it would greatly appreciated. Thank you for any help PS I'm using XSL 2.0 (Saxon 8) Cheers Tom Philosophy: The art of never getting beyond the concept of life. Religion: Morality taking credit for the work of luck.

      G Offline
      G Offline
      George L Jackson
      wrote on last edited by
      #2

      Please post some sample XML data and the desired XSLT output so that I can help you better.

      "We make a living by what we get, we make a life by what we give." --Winston Churchill

      T 1 Reply Last reply
      0
      • G George L Jackson

        Please post some sample XML data and the desired XSLT output so that I can help you better.

        "We make a living by what we get, we make a life by what we give." --Winston Churchill

        T Offline
        T Offline
        TClarke
        wrote on last edited by
        #3

        Hi, thanks for the interest. Here's a chunk of the XML, simplified so as not to consume too much space. As you can see there should be 3 pages of output. Whenever the BLOCKSEQUENCE value returns to 1 a new page started. Therefore, there should be three tables on three pages. The first table should have three rows. The second should have two rows and the third should have one row. I am at a loss as to how to iterate over this XML in such a way as how to do this. XSL-FO to describe the row of a table 1 to describe the row of a table 2 to describe the row of a table 3 to describe the row of a table 1 to describe the row of a table 2 to describe the row of a table 1 My XSL so far is as follows

        G 1 Reply Last reply
        0
        • T TClarke

          Hi, thanks for the interest. Here's a chunk of the XML, simplified so as not to consume too much space. As you can see there should be 3 pages of output. Whenever the BLOCKSEQUENCE value returns to 1 a new page started. Therefore, there should be three tables on three pages. The first table should have three rows. The second should have two rows and the third should have one row. I am at a loss as to how to iterate over this XML in such a way as how to do this. XSL-FO to describe the row of a table 1 to describe the row of a table 2 to describe the row of a table 3 to describe the row of a table 1 to describe the row of a table 2 to describe the row of a table 1 My XSL so far is as follows

          G Offline
          G Offline
          George L Jackson
          wrote on last edited by
          #4

          Your XML was not valid so I used the following: XSL-FO to describe the row of a table 1 to describe the row of a table 2 to describe the row of a table 3 to describe the row of a table 1 to describe the row of a table 2 to describe the row of a table 1 For illustration, I transformed this XML to HTML into 3 sets of tables. The key to the transformation is to get the first following sibling of ROW "following-sibling::ROW[1]" and the "blocksequence" parameter that stops the recursion when BLOCKSEQUENCE does not equal it.: Output:

          1:

          XSL-FO to describe the row of a table

          2:

          to describe the row of a table

          3:

          to describe the row of a table

          1:

          to describe the row of a table

          2:

          T 1 Reply Last reply
          0
          • G George L Jackson

            Your XML was not valid so I used the following: XSL-FO to describe the row of a table 1 to describe the row of a table 2 to describe the row of a table 3 to describe the row of a table 1 to describe the row of a table 2 to describe the row of a table 1 For illustration, I transformed this XML to HTML into 3 sets of tables. The key to the transformation is to get the first following sibling of ROW "following-sibling::ROW[1]" and the "blocksequence" parameter that stops the recursion when BLOCKSEQUENCE does not equal it.: Output:

            1:

            XSL-FO to describe the row of a table

            2:

            to describe the row of a table

            3:

            to describe the row of a table

            1:

            to describe the row of a table

            2:

            T Offline
            T Offline
            TClarke
            wrote on last edited by
            #5

            Thanks George :)

            Cheers Tom Philosophy: The art of never getting beyond the concept of life.
            Religion: Morality taking credit for the work of luck.
            "The object of life is not to be on the side of the majority, but to escape finding oneself in the ranks of the insane." - Marcus Aurelius

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups