Repeating nodes/elements in XSLT

  • I posted this question to StackOverflow. Maybe someone here might be able to help me out.

    The background: I've been tasked with building an ASP.NET form based on a US government grant application. I managed to find the XSD schema, and am building an XSLT file based on the schema.

    I'm building the form based on other working forms. I ran a debug trace to see how the form works, and discovered that it takes the XSLT template, fills in the blanks (so to speak), and saves the entire thing as XML. It works pretty well, and I'd really like to avoid reinventing the wheel.

    Here's my problem: The schema includes a complexType element that allows up to 5 occurrences (i.e. maxOccurs = "5"). That element includes another complexType element with another maxOccurs = "5". And inside of that is another complexType element that allows up to 100 occurrences.

    5 x 5 x 100 = 2500 elements?!? I don't think so!!!

    Does anyone know if there's a way to create these XSLT elements without having to write them out (or copy/paste them) 2500 times??? I tried the <xsl:for-each>, but it won't work in this scenario (refer to my background above about how it first reads the template, then fills in the data for the nodes). I've been looking up documentation all over the place, and I have yet to find anything that helps me.

    Thanks for reading, and your anticipated response . . .

    +--------------------------------------------------------------------------------------+
    Check out my blog at https://pianorayk.wordpress.com/

  • After a couple of days of fruitless searching for an answer to this, I bit the bullet, copy/pasted all my elements, and hardcoded the XSLT. 🙁

    Probably not the best solution, but it does what I need.

    +--------------------------------------------------------------------------------------+
    Check out my blog at https://pianorayk.wordpress.com/

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply