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

Re: captured in a <xsl:for-each>

Subject: Re: captured in a <xsl:for-each>
From: "Alexander Gutman" <gutman@xxxxxxxxxxxxxxx>
Date: Mon, 23 Jul 2001 19:32:47 +0700
xsl for each escape
23.07.2001 19:08:51 owner-xsl-list wrote:
> Hi there!
> 
> I seem to be captured in a for-each loop. Can someone please help me to
> escape and get the expected result?
> 
> <xsl:template match="node()|@*">
>       <xsl:copy>
>                       <xsl:apply-templates select="node()|@*"/>
>       </xsl:copy>
> </xsl:template>
> 
> <xsl:template match="kapitel">
>       <xsl:for-each select="//title">           <!-- "title" is 
hierarchically above "kapital" -->
>                       <p>
>                               <xsl:apply-templates/>
>                        </p>
>               </xsl:for-each>
> </xsl:template>

First of all, the above two template rules "slightly" overlap,
since "kapitel" is also a "node()".
You should use "priority" attributes to disjoint the rules
or reduce the first rule so as it be not applied to "kapitel"s.

> I would like to create a <p> tag for each title and within this
> paragraph I want to copy all the nodes and attributes as they are in the
> source file.

Does this mean that you want to produce a copy
of the ENTIRE document for each "title" in it?
Then you should use a somewhat another approach.

As for the rules you specified, they indeed cause a loop
whenever a "kapitel" occurs inside a "title":
when the "apply-templates" inside your <p> works,
the rule for inner "kapitel"s are recursively applied,
thus working with all "titles" once again.

-- 
Alexander E. Gutman

 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.