|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Counting indent level
On 29/09/2008, at 11:38 AM, G. Ken Holman wrote:
I've got some XML that contains a list of items and groups, and each group could contain either more items or more groups like so : This entire xslt file is pretty simple, it's basically just that one for each and produces a single list of elements. Is there any other advantages (other than easier maintenance) to use templates over the for-each? <xsl:template match="catalog"> <xsl:apply-templates select="*"/> </xsl:template> <xsl:template match="group"> <!--report on the group--> <xsl:apply-templates select="item"/> </xsl:template> <xsl:template match="item"> <!--report on the item--> </xsl:template> This is the same as the above, the first three lines at least - is that what you meant? But yes, you're right, I want all of the items whose parent is either catalog or group as well as all of the groups. (There may be an easier way to do that...) No, this isn't an issue, so the for-each works because the data won't ever have this. I can change the for-each that I'm using, although it has to remain in Ken, does this mean it will retain the overall order though? I want to process them (from my original), as an export (like csv) in the same order so the export would mix and match items and groups : item group group item item etc So it's one single export with both types mixed in the original order. This is why I used a single for-each with the "or" to pick up everything in one go. Plus the code to generate the export line item data is the same for both group and item, so I don't have to have separate templates for them.
This is what i was after, thanks. Thanks for your help. Cheers, Nick
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






