SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Repeating nodes/elements in XSLT


Repeating nodes/elements in XSLT

Author
Message
Ray K
Ray K
Hall of Fame
Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)

Group: General Forum Members
Points: 3817 Visits: 4645
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/
Ray K
Ray K
Hall of Fame
Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)

Group: General Forum Members
Points: 3817 Visits: 4645
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. Sad

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

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


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search