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

RE: Re: Re: Unbounded element grouping/concatenation

Subject: RE: Re: Re: Unbounded element grouping/concatenation
From: "Gupta, Raman K [CI]" <raman.k.gupta@xxxxxxxxxxxxx>
Date: Thu, 11 Dec 2003 10:52:23 -0500
xsl concatenation
> > Dimitre, could you help me with a DVC algorithm for what I'm trying
> > to do? I'm not sure how to apply it to this problem.
> 
> I don't have a good idea of what exactly recursive algorithm 
> you have to
> solve this problem.
> 
> It seems to me that such a recursive algorithm would process 
> the immediate
> following while it is of type="continuation".

The recursive algorithm I wish I could use is exactly as you stated.
Something like the following (not tested, might be typos)

  <xsl:template match="records">
    <xsl:apply-templates select="record[@type = 'normal']"/>
  </xsl:template>

  <xsl:template match="record[@type = 'normal']">
    <record>
      <xsl:copy-of select="*" />
      <xsl:if test="following-sibling::record[1][@type='continuation']">
        <xsl:apply-templates select=following-sibling::record[1]"/>
      </xsl:if>
    </record>
  </xsl:template>

  <xsl:template match="record[@type = 'continuation']">
    <xsl:copy-of select="*" />
    <xsl:if test="following-sibling::record[1][@type='continuation']">
      <xsl:apply-templates select=following-sibling::record[1]"/>
    </xsl:if>
  </xsl:template>

However, this gives me a stack overflow error in Xalan (which I'm
stuck with for now). Actually, it gives me a stack overflow in Saxon
too -- I probably need to use named templates or something to get the
tail recursion optimization to work.

> To put it in other words, this is not a recursion that processes the
> elements of a *known* list, but one that scans a list to find 
> a specific
> element (in this case record with type="normal").

Exactly. I thought there still might be a way to implement DVC if one
could make the list "known" somehow in some efficient way (keys, or some
other xsl magic).

> Often something like binary search can be used to speed up such linear
> recursion, but I don't know if this can be used in this specific case.

How would one do this (for a binary search, don't you again need a known
search space?) What information do you need in order to tell me if it can 
be done for this case?

Cheers,
Raman Gupta

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.