[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XSLT 2: Best Way to Synthesize Elements Given List

Subject: Re: XSLT 2: Best Way to Synthesize Elements Given List of Tagnames
From: "G. Ken Holman g.ken.holman@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 5 Nov 2016 16:46:06 -0000
Re:  XSLT 2: Best Way to Synthesize Elements Given List
At 2016-11-05 16:19 +0000, Eliot Kimber ekimber@xxxxxxxxxxxx wrote:
Say I have this string: "foo/bar" (or any arbitrarily-long sequence of
/-delimited tag names) and want to construct from it:

<foo>
  <bar>
    <!-- Stuff added here that I get from somewhere else -->
  </bar>
</foo>

Is there an easier or more obvious way to generate this than an recursive
function?

I think not. Any function acting on the members of the sequence in sequence will finish a given member (thus closing out the element) before handling the next member.


With a recursive function I can easily create child elements until the
sequence is exhausted but it feels like there should be an easier way
using XSLT 2 but if there is I'm not thinking of it.

I can't either, since you have to process the next member before finishing of any given member. But that next member will have its own next member.


Off the top I can't think of anything that isn't recursion.

. . . . . . . . Ken


-- Check our site for free XML, XSLT, XSL-FO and UBL developer resources | Streaming hands-on XSLT/XPath 2 training @US$45: http://goo.gl/Dd9qBK | Crane Softwrights Ltd. _ _ _ _ _ _ http://www.CraneSoftwrights.com/s/ | G Ken Holman _ _ _ _ _ _ _ _ _ _ mailto:gkholman@xxxxxxxxxxxxxxxxxxxx | Google+ blog _ _ _ _ _ http://plus.google.com/+GKenHolman-Crane/posts | Legal business disclaimers: _ _ http://www.CraneSoftwrights.com/legal |

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.