xsl-list
[Top] [All Lists]

Re: [xsl] Identity Tranlate, too many nested apply-templates

2009-03-24 12:29:40
Boing!  Of course that is the problem!
Here is the entire match template:

    <xsl:template match="Order">
        <xsl:element name="CustomerOrder">
        <xsl:apply-templates select="key('customer', CustomerID)" />
        <xsl:element name="Orders">
            <xsl:apply-templates select=". |
following-sibling::Order[CustomerID = current()/CustomerID]" />
            </xsl:element>
        </xsl:element>
    </xsl:template>

Dohh!  Sometimes the obvious slips right through the fingers.  I'll
add "mode" to my identity-copy routine.
Thanks Martin.

Karl..

On Tue, Mar 24, 2009 at 9:26 AM, Martin Honnen 
<Martin(_dot_)Honnen(_at_)gmx(_dot_)de> wrote:
Karl Stubsjoen wrote:

So I have something like this:

       <xsl:element name="Orders">
           <xsl:apply-templates select=". |
following-sibling::Order[CustomerID = current()/CustomerID]" />
           </xsl:element>
       </xsl:element>


Consider the above a unique match on a node "Order", to which I'm
wrapping in a new node "Orders", and performing other node magic.  I
am then applying templates, as you see, to grab all Order nodes which
have same CusomterID value.  There is also the . "dot" so that I am
adding the uniquely matched Order node to the result.

I have your basic identity copy routine, and it fails in here with
"Too many nested apply-templates calls".  If I remove the . "dot" in
the select above, I do not get this error.  Why?

Can you show us the match pattern? If the above is in an
 <xsl:template match="Order">
and you then do
   <xsl:apply-templates select="."/>
then you get infinite recursion, don't you?
You might want to use a mode attribute to avoid that.



--

       Martin Honnen
       http://JavaScript.FAQTs.com/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>